Skip to content

Commit

Permalink
chore: fix checkout and setup-go ordering to optimize cache usage (#4025
Browse files Browse the repository at this point in the history
)
  • Loading branch information
remyleone authored Aug 7, 2024
1 parent 5f235a7 commit 22d8d48
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout should always be before setup-go to ensure caching is working
- uses: actions/checkout@v4
with:
fetch-depth: 2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ jobs:
name: Ensure docs are generated
runs-on: ubuntu-latest
steps:
# Checkout should always be before setup-go to ensure caching is working
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Generate code
run: go run ./cmd/scw-doc-gen
env:
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Set git to use LF to avoid problem with goldens on windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run unit tests
run: go test ./...
- name: Execute main binary # Test the runtime for potential panics.
run: go run cmd/scw/main.go -h
- name: Set git to use LF to avoid problem with goldens on windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
# Checkout should always be before setup-go to ensure caching is working
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run unit tests
run: go test ./...
- name: Execute main binary # Test the runtime for potential panics.
run: go run cmd/scw/main.go -h

build-tests:
strategy:
Expand All @@ -36,14 +37,15 @@ jobs:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# Checkout should always be before setup-go to ensure caching is working
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build binaries
run: ./scripts/build.sh
- name: Print binaries size
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
# Checkout should always be before setup-go to ensure caching is working
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -20,10 +25,6 @@ jobs:
uses: pnpm/action-setup@v4
with:
version: 6.0.2
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Build
run: ./scripts/build-wasm.sh
- name: Run npm package tests
Expand Down

0 comments on commit 22d8d48

Please sign in to comment.