Skip to content

Commit

Permalink
Use matrix in actions versions
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed Apr 17, 2022
1 parent e7eea45 commit 18fa76d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,32 @@ jobs:
mod:
name: Mod
runs-on: ubuntu-latest
strategy:
matrix:
go:
- 1.18
steps:
- uses: actions/checkout@v3
- name: Read Go version
run: echo "GO_VERSION=$(cat ./.go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-gomod-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
- run: go mod download
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
go:
- 1.18
steps:
- uses: actions/checkout@v3
- name: Read Go version
run: echo "GO_VERSION=$(cat ./.go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ matrix.go }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -40,28 +44,30 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go:
- 1.18
env:
GOCACHE: "/tmp/go/cache"
steps:
- uses: actions/checkout@v3
- name: Read Go version
run: echo "GO_VERSION=$(cat ./.go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-gomod-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- uses: actions/cache@v3
with:
path: /tmp/go/cache
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ github.sha }}
key: ${{ runner.os }}-go-build-${{ matrix.go }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-go-build-${{ github.ref }}-
${{ runner.os }}-go-build-
${{ runner.os }}-go-build-${{ matrix.go }}-${{ github.ref }}-
${{ runner.os }}-go-build-${{ matrix.go }}-
- name: Run tests
run: |-
go test ./... -race -coverprofile=coverage.txt -shuffle=on
Expand All @@ -72,15 +78,17 @@ jobs:
bench:
name: Bench
runs-on: ubuntu-latest
strategy:
matrix:
go:
- 1.18
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read Go version
run: echo "GO_VERSION=$(cat ./.go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ matrix.go }}
- name: Install cob
run: curl -sfL https://raw.githubusercontent.com/knqyf263/cob/master/install.sh | sudo sh -s -- -b /usr/local/bin
- name: Run Benchmark
Expand Down
1 change: 0 additions & 1 deletion .go-version

This file was deleted.

0 comments on commit 18fa76d

Please sign in to comment.