From 3ad3c736fb646b72bc796e1207d9b6a8b2becfe4 Mon Sep 17 00:00:00 2001 From: meyric Date: Mon, 18 Nov 2024 09:01:57 +0000 Subject: [PATCH] Remove independent build and cache job 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. --- .../load-cache/action.yml | 1 + .github/workflows/continuous-integration.yml | 31 ++----------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/actions/continuous-integration/load-cache/action.yml b/.github/actions/continuous-integration/load-cache/action.yml index f1b1085d..d72ba42c 100644 --- a/.github/actions/continuous-integration/load-cache/action.yml +++ b/.github/actions/continuous-integration/load-cache/action.yml @@ -17,3 +17,4 @@ runs: load: true tags: app_test:latest cache-from: type=gha + cache-to: type=gha,mode=min diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8ecc7fae..039074ee 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 @@ -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 @@ -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