Merge pull request #1737 from shirou/dependabot/go_modules/github.com… #1589
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
on: [push, pull_request] | |
name: Test | |
permissions: | |
contents: read | |
jobs: | |
go-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.versions.outputs.value }} | |
steps: | |
- id: versions | |
run: | | |
versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])') | |
echo "::set-output name=value::${versions}" | |
test: | |
needs: go-versions | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: ${{fromJson(needs.go-versions.outputs.versions)}} | |
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-24.04, windows-2022, windows-2019, macos-12, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- id: go-env | |
run: | | |
echo "::set-output name=cache::$(go env GOCACHE)" | |
echo "::set-output name=mod-cache::$(go env GOMODCACHE)" | |
- name: Cache go modules | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: | | |
${{ steps.go-env.outputs.cache }} | |
${{ steps.go-env.outputs.mod-cache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: Test | |
run: | | |
go test -coverprofile='coverage.out' -covermode=atomic ./... |