Update to Rails 8.1 and Ruby 3.4 #165
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-latest | |
| needs: docker-build | |
| env: | |
| COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml | |
| DOCKER_APP_IMAGE: ${{ needs.docker-build.outputs.image }} | |
| 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: Generate secret key base | |
| run: | | |
| docker run --rm "${DOCKER_APP_IMAGE}" rails secret > /tmp/secret_key_base | |
| - name: Setup the stack | |
| run: | | |
| docker compose up --wait | |
| docker compose exec app rails assets:precompile db:prepare | |
| docker compose exec -e RAILS_ENV=test app rails db:prepare | |
| - name: Run RSpec | |
| if: ${{ always() }} | |
| run: | | |
| docker compose exec -e RAILS_ENV=test app rspec --format progress --format html --out artifacts/rspec.html | |
| - name: Run Rubocop | |
| if: ${{ always() }} | |
| run: | | |
| docker compose exec -e RAILS_ENV=test app rubocop --format progress --format html --out artifacts/rubocop.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@v4 | |
| with: | |
| name: UCBEARS Test 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 |