Add prevalent middlewares #87
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: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
test: | |
strategy: | |
# Don't abort the entire matrix if one element fails. | |
fail-fast: false | |
matrix: | |
gover: ["1.22.x", "1.23.x"] | |
include: | |
- gover: "stable" | |
testflags: "-race" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.gover }} | |
- name: Test all | |
run: go test ${{ matrix.testflags }} ./... | |
env: | |
GOARCH: ${{ matrix.goarch }} | |
apidiff: | |
runs-on: ubuntu-22.04 | |
if: (github.event.action && 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change')) | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
- name: Run api-diff | |
uses: joelanford/go-apidiff@main | |
lint: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
cache: false | |
go-version: stable | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
install-mode: "binary" | |
tidy: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
- name: Check go.mod | |
run: | | |
go mod download | |
go mod tidy | |
if [ ! -z "$(git status --porcelain go.mod)" ]; then | |
printf "go.mod has modifications\n" | |
git diff go.mod | |
exit 1 | |
fi | |
if [ ! -z "$(git status --porcelain go.sum)" ]; then | |
printf "go.sum has modifications\n" | |
git diff go.sum | |
exit 1 | |
fi |