Skip to content

Commit 26142bd

Browse files
Merge pull request #3 from github-samples/add-matrix-workflow
Refactor CI workflow for linting and building steps
2 parents 90791c0 + a65ddf2 commit 26142bd

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ on:
88
branches: [ main ]
99
push:
1010
branches: [ main ]
11-
11+
12+
env:
13+
GO_VERSION: '1.24'
1214

1315
jobs:
14-
build:
16+
lint:
17+
name: Lint
1518
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1821

1922
- name: Set up Go
2023
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
2124
with:
22-
go-version: '1.24' # You can change this to your desired Go version
25+
go-version: ${{ env.GO_VERSION }}
2326

2427
- name: Install golangci-lint
2528
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
2629
with:
2730
version: latest
2831

29-
- name: Build
30-
run: go build -v ./...
31-
3232
- name: Lint
3333
run: golangci-lint run
3434

@@ -40,5 +40,23 @@ jobs:
4040
exit 1
4141
fi
4242
43+
build-and-test:
44+
name: Build and Test
45+
needs: lint
46+
runs-on: ${{ matrix.os }}
47+
strategy:
48+
matrix:
49+
os: [ubuntu-latest, macos-latest, windows-latest]
50+
steps:
51+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
52+
53+
- name: Set up Go
54+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
55+
with:
56+
go-version: ${{ env.GO_VERSION }}
57+
58+
- name: Build
59+
run: go build -v ./...
60+
4361
- name: Test
4462
run: go test -v ./...

0 commit comments

Comments
 (0)