Skip to content

Commit

Permalink
WIP: Attempt at building and caching the Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
mec committed Nov 12, 2024
1 parent 87250c5 commit d7df933
Showing 1 changed file with 103 additions and 9 deletions.
112 changes: 103 additions & 9 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,112 @@ on:
- develop

jobs:
test:
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

env:
RAILS_ENV: test

lint-ruby:
name: Linting Ruby
runs-on: ubuntu-latest
needs: build-and-cache
steps:
- name: Check out code
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and cache
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
RAILS_ENV=test
push: false
load: true
tags: app_test:latest
cache-from: type=gha
-
name: Run Standard
run: |
docker run --rm app_test:latest /bin/bash -c "bundle exec standardrb -f simple"
- name: Build
run: script/ci/cibuild
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
needs: build-and-cache
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and cache
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
RAILS_ENV=test
push: false
load: true
tags: complete-app:latest
cache-from: type=gha
-
name: Run Brakeman
run: |
docker run --rm app_test:latest /bin/bash -c "bundle exec brakeman -o /dev/stdout"
- name: Test
run: script/ci/test
specs:
name: Specs and coverage
runs-on: ubuntu-latest
needs: build-and-cache
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and cache
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
RAILS_ENV=test
push: false
load: true
tags: app_test:latest
cache-from: type=gha
-
name: Run RSpec and Simplecov
run: |
docker compose -p complete-app -f docker-compose.ci.yml \
run --name app_test test /bin/bash -c "bin/rails spec"
-
name: Shutdown containers
run: docker compose -p app_test down && docker compose -p app_test rm

0 comments on commit d7df933

Please sign in to comment.