Merge pull request #537 from chainifynet/dependabot/go_modules/exampl… #782
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 | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
unit-tests: | |
# if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
max-parallel: 3 | |
matrix: | |
go: ["1.21.x", "1.22.x", "1.23.x"] | |
include: | |
- go: 1.23.x | |
latest: true | |
name: Unit Tests ${{ matrix.go }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
cache: false | |
go-version: ${{ matrix.go }} | |
- name: Load cached dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go }}- | |
- name: Install dependencies | |
run: make deps | |
- name: Lint | |
if: matrix.latest | |
run: make lint | |
- name: Test | |
run: make unit | |
- name: Generate coverage report | |
if: matrix.latest | |
run: make test-cover | |
- name: Upload coverage to Codecov | |
if: matrix.latest | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests |