From a16fda6938bf86f5d0fa9528da552bb7cb87f036 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Mon, 16 Dec 2024 17:35:45 +1100 Subject: [PATCH] feat: only load docker when needed --- .github/actions/build-cache/action.yml | 6 ++++++ .github/workflows/ci.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/.github/actions/build-cache/action.yml b/.github/actions/build-cache/action.yml index a6635d4a93..f69201aeb4 100644 --- a/.github/actions/build-cache/action.yml +++ b/.github/actions/build-cache/action.yml @@ -1,5 +1,10 @@ name: Build Cache description: Cache builds +inputs: + docker: + description: If the test should load docker images + required: false + default: false runs: using: "composite" # Make sure to keep these cache entries in sync with those in writecache.yml @@ -14,6 +19,7 @@ runs: echo "hash=$hash" >> "$GITHUB_OUTPUT" - name: Restore Hermit Cache uses: actions/cache/restore@v4 + if: inputs.docker == 'true' with: path: ${{ runner.os == 'macOS' && '~/Library/Caches/hermit/pkg' || '~/.cache/hermit/pkg' }} key: ${{ runner.os }}-hermit-cache-${{ steps.bin-hash.outputs.hash }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0a7c10b4c..1a629e8818 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -267,8 +267,15 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Check if Docker Required + id: check-docker + run: | + result="$(git grep -E '//ftl:subscribe|DefaultPostgresDatabaseConfig|DefaultMySQLDatabaseConfig' -- $(git grep -l '^//go:build integration' | xargs grep -l '^func TestPubSub' | xargs -I {} dirname ./{})/testdata || true)" + echo "docker_req=$result" >> $GITHUB_ENV - name: Build Cache uses: ./.github/actions/build-cache + with: + docker: ${{ env.result != ''}} - name: Init Hermit uses: cashapp/activate-hermit@v1.1.3 - name: Docker Compose