GHA: Use shared workflow for multi-arch builds #69
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build / Test / Push | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| workflow_call: | |
| workflow_dispatch: | |
| jobs: | |
| docker-build: | |
| uses: BerkeleyLibrary/.github/.github/workflows/docker-build.yml@v2.0.0 | |
| with: | |
| image: ghcr.io/${{ github.repository }} | |
| secrets: inherit | |
| test: | |
| runs-on: ubuntu-24.04 | |
| needs: docker-build | |
| env: | |
| COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml | |
| DOCKER_APP_IMAGE: ${{ needs.docker-build.outputs.image }} | |
| SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Compose | |
| uses: docker/setup-compose-action@v2 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup the stack | |
| run: | | |
| docker compose up --wait | |
| docker compose exec app rails assets:precompile | |
| docker compose exec -u root app chown -R nara:nara artifacts | |
| - name: Run RSpec | |
| if: ${{ always() }} | |
| run: | | |
| docker compose exec -e RAILS_ENV=test app rake check | |
| - name: Run Rubocop | |
| if: ${{ always() }} | |
| run: | | |
| docker compose exec -e RAILS_ENV=test app rubocop --format progress --format html --out artifacts/rubocop.html | |
| - name: Run Brakeman | |
| if: ${{ always() }} | |
| run: | | |
| docker compose exec -e RAILS_ENV=test app brakeman -o artifacts/brakeman.html | |
| - name: Copy out artifacts | |
| if: ${{ always() }} | |
| run: | | |
| docker compose cp app:/opt/app/artifacts ./ | |
| docker compose logs > artifacts/docker-compose-services.log | |
| docker compose config > artifacts/docker-compose.merged.yml | |
| - name: Upload the test report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ruby-nara Build Report (${{ github.run_id }}_${{ github.run_attempt }}) | |
| path: artifacts/* | |
| if-no-files-found: error | |
| push: | |
| needs: | |
| - docker-build | |
| - test | |
| uses: BerkeleyLibrary/.github/.github/workflows/docker-push.yml@v2.0.0 | |
| with: | |
| image: ghcr.io/${{ github.repository }} | |
| build-image-arm64: ${{ needs.docker-build.outputs.image-arm64 }} | |
| build-image-x64: ${{ needs.docker-build.outputs.image-x64 }} | |
| secrets: inherit |