diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3e5a0a40..b210b650 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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