Skip to content

Commit 22d8d48

Browse files
authored
chore: fix checkout and setup-go ordering to optimize cache usage (#4025)
1 parent 5f235a7 commit 22d8d48

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12+
# Checkout should always be before setup-go to ensure caching is working
1213
- uses: actions/checkout@v4
1314
with:
1415
fetch-depth: 2

.github/workflows/docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ jobs:
77
name: Ensure docs are generated
88
runs-on: ubuntu-latest
99
steps:
10+
# Checkout should always be before setup-go to ensure caching is working
1011
- uses: actions/checkout@v4
12+
- uses: actions/setup-go@v5
13+
with:
14+
go-version: '1.22'
1115
- name: Generate code
1216
run: go run ./cmd/scw-doc-gen
1317
env:

.github/workflows/unit-tests.yaml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ jobs:
1212
platform: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.platform }}
1414
steps:
15-
- name: Install Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: ${{ matrix.go-version }}
19-
- name: Set git to use LF to avoid problem with goldens on windows
20-
run: |
21-
git config --global core.autocrlf false
22-
git config --global core.eol lf
23-
- name: Checkout
24-
uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 1
27-
- name: Run unit tests
28-
run: go test ./...
29-
- name: Execute main binary # Test the runtime for potential panics.
30-
run: go run cmd/scw/main.go -h
15+
- name: Set git to use LF to avoid problem with goldens on windows
16+
run: |
17+
git config --global core.autocrlf false
18+
git config --global core.eol lf
19+
# Checkout should always be before setup-go to ensure caching is working
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
24+
- name: Install Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ matrix.go-version }}
28+
- name: Run unit tests
29+
run: go test ./...
30+
- name: Execute main binary # Test the runtime for potential panics.
31+
run: go run cmd/scw/main.go -h
3132

3233
build-tests:
3334
strategy:
@@ -36,14 +37,15 @@ jobs:
3637
platform: [ubuntu-latest]
3738
runs-on: ${{ matrix.platform }}
3839
steps:
39-
- name: Install Go
40-
uses: actions/setup-go@v5
41-
with:
42-
go-version: ${{ matrix.go-version }}
40+
# Checkout should always be before setup-go to ensure caching is working
4341
- name: Checkout
4442
uses: actions/checkout@v4
4543
with:
4644
fetch-depth: 1
45+
- name: Install Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: ${{ matrix.go-version }}
4749
- name: Build binaries
4850
run: ./scripts/build.sh
4951
- name: Print binaries size

.github/workflows/wasm.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ jobs:
1212
platform: [ubuntu-latest]
1313
runs-on: ${{ matrix.platform }}
1414
steps:
15+
# Checkout should always be before setup-go to ensure caching is working
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 1
1520
- name: Install Go
1621
uses: actions/setup-go@v5
1722
with:
@@ -20,10 +25,6 @@ jobs:
2025
uses: pnpm/action-setup@v4
2126
with:
2227
version: 6.0.2
23-
- name: Checkout
24-
uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 1
2728
- name: Build
2829
run: ./scripts/build-wasm.sh
2930
- name: Run npm package tests

0 commit comments

Comments
 (0)