Skip to content

import github.com/databacker/api instead of defining locally #346

import github.com/databacker/api instead of defining locally

import github.com/databacker/api instead of defining locally #346

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@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- id: fileschanged
run: |
case '${{ github.event_name }}' in
push)
firstCommit='${{ github.event.before }}'
lastCommit='${{ github.event.after }}'
;;
pull_request)
firstCommit='${{ github.event.pull_request.base.sha }}'
lastCommit='${{ github.event.pull_request.head.sha }}'
;;
esac
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@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
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@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: false
platforms: linux/amd64,linux/arm64
tags: |
${{env.IMAGE_NAME}}:${{github.sha}}
- name: test
run: make test