always run (ie: failure or success) and obey debug as condition to ex… #1179
Workflow file for this run
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: Go CI | ||
on: | ||
workflow_call: | ||
inputs: | ||
go-version: | ||
description: 'Go version' | ||
required: true | ||
type: string | ||
debug: | ||
description: 'Debug mode - enables and saves verbose log output' | ||
required: false | ||
default: 'false' | ||
type: string | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: v1.55 | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
go_mod_tidy_check: | ||
name: Go Mod Tidy Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- run: go mod tidy | ||
- name: check for diff | ||
run: git diff --exit-code | ||
test_coverage: | ||
needs: [lint, go_mod_tidy_check] | ||
name: Unit Tests Coverage | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
OS: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: run unit tests | ||
run: make test-unit ENABLE_VERBOSE=${{ inputs.debug }} | ||
- name: upload coverage | ||
uses: codecov/[email protected] | ||
with: | ||
env_vars: OS | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.txt | ||
name: coverage-${{ matrix.os }} | ||
- name: Upload unit test output | ||
uses: actions/upload-artifact@v3 | ||
if: always() && github.event.inputs.debug == 'true' | ||
with: | ||
name: unit-test-output-${{ matrix.os }} | ||
path: | | ||
debug.log | ||
coverage.txt | ||
retention-days: 5 | ||
unit_race_test: | ||
needs: [lint, go_mod_tidy_check] | ||
name: Run Unit Tests with Race Detector | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: execute test run | ||
run: make test-unit-race | ||
continue-on-error: true | ||
integration_test: | ||
needs: [lint, go_mod_tidy_check] | ||
name: Run Integration Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: Swamp Tests | ||
run: make test-swamp | ||
continue-on-error: true | ||
- name: Swamp Tests with Race Detector | ||
run: make test-swamp-race | ||
continue-on-error: true |