Update docker/build-push-action action to v7.3.0 - autoclosed #6790
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: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| release: | |
| types: [published] | |
| merge_group: | |
| types: [checks_requested] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME_RUNTIME: ${{ github.repository }}/runtime | |
| jobs: | |
| test: | |
| name: "Test backpex" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - elixir: "1.16" | |
| otp: "26.2" | |
| - elixir: "1.17" | |
| otp: "27.3" | |
| - elixir: "1.18" | |
| otp: "28.0" | |
| - elixir: "1.19" | |
| otp: "28.1" | |
| - elixir: "1.20" | |
| otp: "29.0" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| with: | |
| otp-version: ${{ matrix.otp }} | |
| elixir-version: ${{ matrix.elixir }} | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: "1.3.14" | |
| - name: Restore the deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| id: restore-cache | |
| env: | |
| MIX_LOCK_HASH: ${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-build-deps-mixlockhash-${{ env.MIX_LOCK_HASH }} | |
| restore-keys: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-build-deps- | |
| - name: Install dependencies | |
| if: steps.restore-cache.outputs.cache-hit != 'true' | |
| run: mix deps.get | |
| - name: Compile dependencies | |
| if: steps.restore-cache.outputs.cache-hit != 'true' | |
| run: mix deps.compile | |
| - name: Compile with warnings as errors | |
| run: mix compile --warnings-as-errors --force | |
| - name: Cache bun install cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-store-${{ hashFiles('bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun-store- | |
| - name: Install node dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Check formatting | |
| run: mix format --check-formatted | |
| - name: JavaScript Standard | |
| run: bun run lint:standard | |
| - name: Build docs with warnings as errors | |
| run: mix docs --warnings-as-errors | |
| - name: Credo | |
| run: mix credo | |
| - name: Sobelow | |
| run: mix sobelow --config | |
| - name: Deps Unused | |
| run: mix deps.unlock --check-unused | |
| - name: Run tests | |
| run: mix test | |
| - name: Run doc tests | |
| run: mix test test/doc_test.exs | |
| - name: Deps Audit | |
| continue-on-error: true | |
| run: mix deps.audit | |
| - name: Gettext Check | |
| run: mix gettext.extract --check-up-to-date | |
| - name: Check assets up-to-date | |
| run: mix assets.check | |
| publish: | |
| needs: [test, test-demo] | |
| if: github.event_name == 'release' | |
| name: "Publish package on hex.pm" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| id: beam | |
| with: | |
| version-file: .tool-versions | |
| version-type: strict | |
| - name: Install dependencies | |
| run: | | |
| mix local.hex --force --if-missing | |
| mix local.rebar --force --if-missing | |
| mix deps.get | |
| - name: Publish package on hex.pm | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
| run: mix hex.publish --yes | |
| test-demo: | |
| name: "Test (Demo)" | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16.14@sha256:eb4759788a2182f08257135e61a34f2cfc3c2914079f3465d64ee62350f4d081 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - "5432:5432" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Setup beam | |
| uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| id: beam | |
| with: | |
| version-file: .tool-versions | |
| version-type: strict | |
| - name: Setup node | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: "1.3.14" | |
| - name: Restore the deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| id: restore-cache | |
| env: | |
| OTP_VERSION: ${{ steps.beam.outputs.otp-version }} | |
| ELIXIR_VERSION: ${{ steps.beam.outputs.elixir-version }} | |
| MIX_LOCK_HASH: ${{ hashFiles(format('{0}{1}', github.workspace, '/demo/mix.lock')) }} | |
| with: | |
| path: | | |
| demo/deps | |
| demo/_build | |
| key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-build-deps-demo-mixlockhash-${{ env.MIX_LOCK_HASH }} | |
| restore-keys: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-build-deps-demo- | |
| - name: Install dependencies | |
| if: steps.restore-cache.outputs.cache-hit != 'true' | |
| working-directory: demo | |
| run: mix deps.get | |
| - name: Compile dependencies | |
| if: steps.restore-cache.outputs.cache-hit != 'true' | |
| working-directory: demo | |
| run: mix deps.compile | |
| - name: Compile with warnings as errors | |
| working-directory: demo | |
| run: mix compile --warnings-as-errors --force | |
| - name: Cache bun install cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-store-${{ hashFiles('demo/bun.lock', 'bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun-store- | |
| - name: Install node dependencies | |
| working-directory: demo | |
| run: bun install --frozen-lockfile | |
| - name: Install Backpex node dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Setup assets | |
| working-directory: demo | |
| run: mix assets.setup | |
| - name: Build assets | |
| working-directory: demo | |
| run: mix assets.build | |
| - name: lint:mix | |
| working-directory: demo | |
| run: bun run lint:mix | |
| - name: lint:credo | |
| working-directory: demo | |
| run: bun run lint:credo | |
| - name: lint:sobelow | |
| working-directory: demo | |
| run: bun run lint:sobelow | |
| - name: lint:style | |
| working-directory: demo | |
| run: bun run lint:style | |
| - name: lint:standard | |
| working-directory: demo | |
| run: bun run lint:standard | |
| - name: lint:deps-unused | |
| working-directory: demo | |
| run: bun run lint:deps-unused | |
| - name: lint:gettext | |
| working-directory: demo | |
| run: bun run lint:gettext | |
| - name: Deps audit | |
| working-directory: demo | |
| continue-on-error: true | |
| run: mix deps.audit | |
| - name: Run test | |
| working-directory: demo | |
| env: | |
| DB_HOSTNAME: localhost | |
| DB_USERNAME: postgres | |
| DB_PASSWORD: postgres | |
| DB_DATABASE: test | |
| run: bun run test | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('demo/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Install playwright | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| working-directory: demo | |
| run: bun x playwright install chromium --with-deps --only-shell | |
| - name: Run playwright test | |
| working-directory: demo | |
| env: | |
| DB_HOSTNAME: localhost | |
| DB_USERNAME: postgres | |
| DB_PASSWORD: postgres | |
| DB_DATABASE: test | |
| run: bun run test:playwright || if [[ $? = 2 ]]; then PW_TRACE=true bun run test:playwright --max-cases 1 --failed; else false; fi | |
| - name: Upload Playwright traces | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: playwright-traces | |
| path: tmp/ | |
| retention-days: 7 | |
| build-runtime: | |
| name: "Build and push image (Demo)" | |
| runs-on: ubuntu-latest | |
| needs: [test, test-demo] | |
| env: | |
| PUSH_IMAGE: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Log in to the container registry | |
| if: env.PUSH_IMAGE == 'true' | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_RUNTIME }} | |
| - name: Build container | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| push: ${{ env.PUSH_IMAGE }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_RUNTIME }}:buildcache | |
| cache-to: ${{ env.PUSH_IMAGE == 'true' && format('type=registry,ref={0}/{1}:buildcache,mode=max', env.REGISTRY, env.IMAGE_NAME_RUNTIME) || '' }} | |
| target: runtime | |
| build-args: | | |
| MIX_ENV=prod |