Skip to content

Commit

Permalink
Remove independent build and cache job
Browse files Browse the repository at this point in the history
Our caching strategy is to cached across CI jobs with the focus on
caching the layers in the Docker image.

As each job has to build the image from (using the cache) regardless, we
think we can get rid of the independent build and cache job and let the
caching happen as we run each job.

The only way to see if this pays off is to merge the changes and run
another CI workflow to see how much caching we get.
  • Loading branch information
mec committed Dec 13, 2024
1 parent 56915a2 commit 3ad3c73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ runs:
load: true
tags: app_test:latest
cache-from: type=gha
cache-to: type=gha,mode=min
31 changes: 3 additions & 28 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,15 @@ on:
- develop

jobs:
build-and-cache:
name: Build and cache image
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and cache image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: RAILS_ENV=test
push: false
tags: app_test:latest
cache-from: type=gha
cache-to: type=gha,mode=min

lint-and-format:
name: Lint and format application
runs-on: ubuntu-latest
needs: build-and-cache
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Load cache
name: Build and cache
uses: ./.github/actions/continuous-integration/load-cache
-
name: Run linters and formatters
Expand All @@ -54,13 +31,12 @@ jobs:
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
needs: build-and-cache
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Load cache
name: Build and cache
uses: ./.github/actions/continuous-integration/load-cache
-
name: Run Brakeman
Expand All @@ -70,13 +46,12 @@ jobs:
specs:
name: Specs and coverage
runs-on: ubuntu-latest
needs: build-and-cache
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Load cache
name: Build and cache
uses: ./.github/actions/continuous-integration/load-cache
-
name: Run RSpec and Simplecov
Expand Down

0 comments on commit 3ad3c73

Please sign in to comment.