Code #19
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: Code | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
- v* | |
pull_request: | |
schedule: | |
- cron: '38 5 * * 3' | |
concurrency: | |
group: ${{ format('{0}-{1}', github.workflow, github.head_ref) }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
UnitTestJob: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: | |
- "1.21" | |
- "1.22" | |
- "1.23" | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] # immutable action, safe to use the versions | |
- name: Install Go | |
uses: actions/[email protected] # immutable action, safe to use the versions | |
with: | |
go-version: ${{ matrix.go }} | |
- name: gofmt | |
run: diff -u <(echo -n) <(gofmt -l . ) | |
- name: show diff | |
if: ${{ failure() }} | |
run: git diff | |
- name: go vet | |
run: go vet ./... | |
- name: Run Unit Tests | |
run: go test -race -cover -coverprofile=coverage.out -covermode=atomic ./... | |
- name: Codecov | |
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
UnitTests: | |
if: ${{ always() }} | |
needs: UnitTestJob | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check status | |
if: ${{ needs.UnitTestJob.result != 'success' }} | |
run: exit 1 |