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 0f06d36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 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 @@ -22,6 +27,7 @@ runs:
${{ runner.os }}-hermit-cache-
- name: Restore Docker Images
uses: ScribeMD/[email protected]
if: inputs.docker == 'true'
with:
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }}
read-only: true
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,23 @@ 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 ${{ matrix.test }}' | xargs -I {} dirname ./{})/testdata" || true)"
if [ -z "$result" ]; then
echo "docker not required"
echo "docker_req=false" >> "$GITHUB_ENV"
else
echo "docker required"
echo "docker_req=true" >> "$GITHUB_ENV"
fi
- name: Build Cache
uses: ./.github/actions/build-cache
with:
docker: ${{ env.docker_req }}
- name: Init Hermit
uses: cashapp/[email protected]
- name: Docker Compose
run: just compose-up
- name: Download Go Modules
run: go mod download
- name: Build Language Plugins
Expand Down

0 comments on commit 0f06d36

Please sign in to comment.