fix: add concurrency to stop older actions run #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- '**' | |
concurrency: | |
group: ci-${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Print Go environment | |
run: go env | |
- name: Build Application | |
run: make build | |
# needs: build, in other jobs is to utilize the go cache created by build | |
lint: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Run Lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59 | |
args: --timeout=10m | |
unit-tests: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Run Unit Tests | |
run: | | |
make test | |
check-mock-gen: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Run make mock-gen | |
run: make mocks | |
- name: Check for uncommitted changes | |
run: | | |
if ! git diff --exit-code; then | |
echo "Uncommitted changes detected. Please run 'make mocks' before committing." | |
exit 1 | |
fi | |
build-integration-tests: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build E2E Dockers | |
run: | | |
sudo make build-docker-e2e | |
run-integration-tests: | |
needs: build-integration-tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Run E2E Tests | |
run: | | |
sudo make test-e2e-cache |