mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-22 02:43:36 +08:00
Delegate package execution, coverage aggregation, and failure handling to go test. Let Go choose atomic coverage when race detection is enabled and list the existing test packages explicitly to surface loading errors. Add isolated Makefile regression checks for successful execution, combined coverage, flag forwarding, and failures that output matching can miss. Run these checks on both operating systems and supported Go versions.
92 lines
2.1 KiB
YAML
92 lines
2.1 KiB
YAML
name: Run Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: "^1"
|
|
- name: Setup golangci-lint
|
|
uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: v2.11
|
|
args: --verbose
|
|
test:
|
|
needs: lint
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
go: ["1.26", "1.27"]
|
|
test-tags:
|
|
[
|
|
"",
|
|
"-tags nomsgpack",
|
|
'--ldflags="-checklinkname=0" -tags sonic',
|
|
"-tags go_json",
|
|
"-race",
|
|
]
|
|
include:
|
|
- os: ubuntu-latest
|
|
go-build: ~/.cache/go-build
|
|
- os: macos-latest
|
|
go-build: ~/Library/Caches/go-build
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }} ${{ matrix.test-tags }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
TESTTAGS: ${{ matrix.test-tags }}
|
|
GOPROXY: https://proxy.golang.org
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go }}
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
cache: false
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
|
|
- uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
${{ matrix.go-build }}
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Test Makefile
|
|
if: matrix.test-tags == ''
|
|
run: sh .github/scripts/test-makefile.sh
|
|
|
|
- name: Run Tests
|
|
run: make test
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
use_oidc: true
|
|
flags: ${{ matrix.os }},go-${{ matrix.go }},${{ matrix.test-tags }}
|