Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix checkout and setup-go ordering to optimize cache usage #4025

Merged
merged 9 commits into from
Aug 7, 2024
Merged
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
Loading