Code #36
This file contains hidden or 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/checkout@v4.2.2 # immutable action, safe to use the versions | |
| - name: Install Go | |
| uses: actions/setup-go@v5.3.0 # 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@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 | |
| 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 |