From f4c18871d2ac0f416f94099cd0fdf09b9ab3cf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Fri, 2 Aug 2024 17:14:58 +0200 Subject: [PATCH] chore: fix checkout and setup-go ordering to optimize cache usage (#187) --- .github/workflows/nightly.yml | 5 +++-- .github/workflows/unit-tests.yml | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 73549bf..25a5ee5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,12 +13,13 @@ 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 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - - name: Checkout - uses: actions/checkout@v4 - name: Install plugin run: make install-plugin - name: Build binaries diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 87457c8..56877ac 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,14 +12,20 @@ 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: go-version: ${{ matrix.go-version }} - - name: Checkout - uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v3 with: - fetch-depth: 1 + go-version: ${{ matrix.go-version }} - name: Build binaries run: make build - name: Run unit tests @@ -32,13 +38,20 @@ 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: go-version: ${{ matrix.go-version }} - - name: Checkout - uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v3 with: - fetch-depth: 1 + go-version: ${{ matrix.go-version }} - name: Generate run: make generate