Skip to content

Fix workflow execution error #327

Fix workflow execution error

Fix workflow execution error #327

Workflow file for this run

name: Continuous Integration
on:
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '**/*.md'
push:
branches:
- master
- main
paths-ignore:
- '**/*.md'
env:
IMAGE_NAME: "databack/mysql-backup"
jobs:
report:
name: Report
runs-on: ubuntu-latest
outputs:
non_docs_changed: ${{ steps.fileschanged.outputs.non_doc_files_changed }}
steps:
- name: ref
run: echo ${{ github.ref }}
- name: event_name
run: echo ${{ github.event_name }}
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- id: fileschanged
run: |
firstCommit='${{ github.event.before }}'
lastCommit='${{ github.event.after }}'
changedFiles=$(git diff --name-only --diff-filter=d "${firstCommit}" "${lastCommit}")
echo "Files changed: $changedFiles"
NON_MD_FILES=$(echo "$changedFiles" | grep -v '\.md$' || true)
if [ -n "$NON_MD_FILES" ]; then
echo "non_doc_files_changed=true" >> $GITHUB_OUTPUT
else
echo "non_doc_files_changed=false" >> $GITHUB_OUTPUT
fi
ci:
name: CI
runs-on: ubuntu-latest
needs: [ report ]
if: needs.report.outputs.non_docs_changed == 'true'
steps:
- name: checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Build
run: go build -o dist/mysql-backup -v .
- name: vet
run: make vet
- name: Test
run: make test
- name: Integration Test
run: make integration_test
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
platforms: linux/amd64,linux/arm64
tags: |
${{env.IMAGE_NAME}}:${{github.sha}}
- name: test
run: make test