Update google.golang.org #1366
Workflow file for this run
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 | |
permissions: read-all | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
# Default minimum version of Go to support. | |
DEFAULT_GO_VERSION: "1.23.1" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Tools cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-tools-cache | |
with: | |
path: ~/.tools | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} | |
- name: Generate | |
run: make generate | |
- name: Build | |
run: make build | |
- name: Run linters | |
run: make lint | |
- name: Fixtures | |
run: make fixtures | |
- name: Check clean repository | |
run: make check-clean-work-tree | |
test-race: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Run tests with race detector | |
run: make test | |
test-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
check-latest: true | |
cache-dependency-path: "**/go.sum" | |
- name: Run coverage tests | |
run: make test-coverage | |
- name: Store coverage test output | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-artifacts-${{ env.DEFAULT_GO_VERSION }} | |
path: coverage.txt | |
codecov: | |
runs-on: ubuntu-latest | |
needs: [test-coverage] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-artifacts-${{ env.DEFAULT_GO_VERSION }} | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4.6.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./coverage.txt | |
verbose: true | |
compatibility-test: | |
strategy: | |
matrix: | |
go-version: ["1.23.1", "1.22.5", "1.21"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
arch: ["386", amd64] | |
exclude: | |
# Not a supported Go OS/architecture. | |
- os: macos-latest | |
arch: "386" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Run tests | |
env: | |
GOARCH: ${{ matrix.arch }} | |
run: make test-short |