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

feat: only load docker when needed #3781

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,26 @@ 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
if: env.docker_req == 'true'
- name: Download Go Modules
run: go mod download
- name: Build Language Plugins
Expand Down
Loading