Skip to content

Commit

Permalink
feat: only load docker when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Dec 16, 2024
1 parent e166171 commit 9220f14
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/actions/build-cache/action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,19 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if Docker Required
id: check-docker
run: |

Check failure on line 272 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / Lint

shellcheck reported issue in this script: SC2086:info:3:30: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 272 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / Lint

shellcheck reported issue in this script: SC2086:info:5:29: Double quote to prevent globbing and word splitting [shellcheck]
result="$(git grep -E '//ftl:subscribe|DefaultPostgresDatabaseConfig|DefaultMySQLDatabaseConfig' -- "$(git grep -l '^//go:build integration' | xargs grep -l '^func ${{ matrix.test }}' | xargs -I {} dirname ./{})/testdata" || true)"
if [ -z "$result" ]; then
echo "docker_req=false" >> $GITHUB_ENV
else
echo "docker_req=true" >> $GITHUB_ENV
fi
- name: Build Cache
uses: ./.github/actions/build-cache
with:
docker: ${{ env.result != ''}}
- name: Init Hermit
uses: cashapp/[email protected]
- name: Docker Compose
Expand Down

0 comments on commit 9220f14

Please sign in to comment.