patch: v2.9.2 #126
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: Run tests | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
- '**.yaml' | |
- 'examples/*' | |
- '!.github/workflows/test.yml' | |
pull_request: | |
branches: | |
- master | |
- dev | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
- '**.yaml' | |
- 'examples/*' | |
- '!.github/workflows/test.yml' | |
env: | |
GO111MODULE: on | |
GOPROXY: "https://proxy.golang.org" | |
jobs: | |
lint: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
name: Run golangci-lint | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.16' | |
cache: false | |
- name: Setup and run golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.57.2 | |
args: --timeout 5m -v -E gofumpt -E gocritic -E misspell -E revive -E godot | |
test: | |
needs: lint | |
strategy: | |
fail-fast: false | |
matrix: | |
go: [1.13, 1.22] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
# TODO(panjf2000): There is an uncanny issue arising when downloading | |
# go modules on macOS 13 for Go1.13. So we use macOS 12 for now, | |
# but try to figure it out and use macOS once it's resolved. | |
# https://github.com/panjf2000/ants/actions/runs/9546726268/job/26310385582 | |
- go: 1.13 | |
os: macos-12 | |
exclude: | |
# Starting macOS 14 GitHub Actions runners are arm-based, | |
# but Go didn't support arm64 until 1.16. Thus, we must | |
# replace the macOS 14 runner with macOS 12 runner for Go 1.13. | |
# Ref: https://github.com/actions/runner-images/issues/9741 | |
- go: 1.13 | |
os: macos-latest | |
name: Go ${{ matrix.go }} @ ${{ matrix.os }} | |
runs-on: ${{ matrix.os}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Print Go environment | |
id: go-env | |
run: | | |
printf "Using go at: $(which go)\n" | |
printf "Go version: $(go version)\n" | |
printf "\n\nGo environment:\n\n" | |
go env | |
printf "\n\nSystem environment:\n\n" | |
env | |
# Calculate the short SHA1 hash of the git commit | |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "GO_CACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Run unit tests and integrated tests | |
run: go test -v -race -coverprofile="codecov.report" -covermode=atomic | |
- name: Upload code coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./codecov.report | |
flags: unittests | |
name: codecov-ants | |
fail_ci_if_error: true | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |