Skip to content

Commit f8e4632

Browse files
committed
refactor
1 parent 89f60fc commit f8e4632

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

.github/actions/setup/action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: setup
3+
description: Common tasks for preparing the environment
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
- uses: actions/setup-go@v5
9+
if: runner.os != 'Windows'
10+
with:
11+
go-version-file: go.mod
12+
cache: true
13+
# See https://github.com/actions/setup-go/pull/515
14+
- uses: antontroshin/setup-go@bda02de8887c9946189f81e7e59512914aeb9ea4
15+
if: runner.os == 'Windows'
16+
with:
17+
go-version-file: go.mod
18+
cache: true
19+
- name: install mage
20+
run: go install github.com/magefile/mage
21+
shell: 'bash'

.github/workflows/ci.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ permissions:
1212
jobs:
1313

1414
lint:
15-
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
os: ['ubuntu-latest', 'windows-latest']
18+
runs-on: ${{ matrix.os }}
1619
steps:
1720
- uses: actions/checkout@v4
18-
- uses: actions/setup-go@v5
19-
with:
20-
go-version-file: go.mod
21-
cache: true
22-
- name: install mage
23-
run: go install github.com/magefile/mage
21+
- uses: ./.github/actions/setup
2422
- run: |
2523
mage -debug check
2624
go vet ./...
@@ -29,40 +27,22 @@ jobs:
2927
runs-on: ubuntu-latest
3028
steps:
3129
- uses: actions/checkout@v4
32-
- uses: actions/setup-go@v5
33-
with:
34-
go-version-file: go.mod
35-
cache: true
36-
- name: install mage
37-
run: go install github.com/magefile/mage
30+
- uses: ./.github/actions/setup
3831
- name: install protoc
3932
run: |
4033
curl -sSfL -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip
4134
mkdir -p $GITHUB_WORKSPACE/.protoc
4235
unzip -o protoc.zip -d $GITHUB_WORKSPACE/.protoc
4336
echo "$GITHUB_WORKSPACE/.protoc/bin" >> $GITHUB_PATH
37+
4438
- run: mage -debug update
4539

4640
test:
4741
strategy:
4842
matrix:
49-
os: ['macos-latest', 'ubuntu-latest']
43+
os: ['ubuntu-latest', 'windows-latest']
5044
runs-on: ${{ matrix.os }}
5145
steps:
5246
- uses: actions/checkout@v4
53-
- uses: actions/setup-go@v5
54-
with:
55-
go-version-file: go.mod
56-
cache: true
57-
- run: go test -v -race ./...
58-
59-
test-windows:
60-
runs-on: 'windows-latest'
61-
steps:
62-
- uses: actions/checkout@v4
63-
# See https://github.com/actions/setup-go/pull/515
64-
- uses: antontroshin/setup-go@bda02de8887c9946189f81e7e59512914aeb9ea4
65-
with:
66-
go-version-file: go.mod
67-
cache: true
47+
- uses: ./.github/actions/setup
6848
- run: go test -v -race ./...

0 commit comments

Comments
 (0)