Merge pull request #175 from shopware/dependabot/github_actions/octo-… #1044
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 Base Images | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| schedule: | |
| - cron: '10 4 * * *' | |
| concurrency: | |
| group: "${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| COSIGN_EXPERIMENTAL: 1 | |
| permissions: | |
| contents: write | |
| id-token: write | |
| packages: write | |
| pull-requests: write | |
| jobs: | |
| frankenphp: | |
| name: FrankenPHP | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| frankenphp*/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: frankenphp | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| frankenphp-otel: | |
| name: FrankenPHP with OpenTelemetry | |
| runs-on: namespace-profile-default | |
| needs: [frankenphp] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| frankenphp*/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: frankenphp-otel | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| fpm: | |
| name: FPM | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm*/** | |
| nginx/** | |
| caddy/** | |
| dev/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: fpm | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| fpm-otel: | |
| name: FPM with OpenTelemetry | |
| runs-on: ubuntu-latest | |
| needs: [fpm] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm*/** | |
| nginx/** | |
| caddy/** | |
| dev/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: fpm-otel | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| webserver: | |
| name: ${{ matrix.webserver }} | |
| runs-on: ubuntu-latest | |
| needs: [fpm] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| webserver: [ caddy, nginx ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm/** | |
| ${{ matrix.webserver }}/** | |
| dev/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: ${{ matrix.webserver}} | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| webserver-otel: | |
| name: ${{ matrix.webserver }} with OpenTelemetry | |
| runs-on: ubuntu-latest | |
| needs: [fpm-otel] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| webserver: [ caddy, nginx ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm/** | |
| ${{ matrix.webserver }}/** | |
| dev/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: ${{ matrix.webserver}}-otel | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| dev: | |
| name: Dev ${{ matrix.webserver }} | |
| runs-on: ubuntu-latest | |
| needs: [webserver-otel] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| webserver: [ caddy, nginx ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm/** | |
| ${ matrix.webserver }/** | |
| dev/** | |
| - name: Build | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/action/build-bake-publish | |
| with: | |
| targets: ${{ matrix.webserver }}-dev | |
| docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| dev-check: | |
| name: Check Dev Image | |
| runs-on: ubuntu-latest | |
| needs: [dev] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| fpm/** | |
| nginx/** | |
| caddy/** | |
| dev/** | |
| - name: Install a binary from GitHub releases | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: jaxxstorm/[email protected] | |
| with: | |
| repo: GoogleContainerTools/container-structure-test | |
| extension-matching: disable | |
| rename-to: container-structure-test | |
| chmod: 0755 | |
| - name: Determine image tag | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| id: image-tag | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "IMAGE_TAG=ghcr.io/shopware/docker-dev-ci-test:${{ github.event.number }}-php8.4-node24-caddy" >> $GITHUB_OUTPUT | |
| else | |
| echo "IMAGE_TAG=ghcr.io/shopware/docker-dev:php8.4-node24-caddy" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Pull image | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: docker pull ${{ steps.image-tag.outputs.IMAGE_TAG }} | |
| - name: Test Dev Image | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: container-structure-test test --config dev/config.yaml --image ${{ steps.image-tag.outputs.IMAGE_TAG }} | |
| check: | |
| name: Test Image with Webserver ${{ matrix.webserver }} | |
| runs-on: ubuntu-latest | |
| needs: [webserver] | |
| strategy: | |
| matrix: | |
| webserver: | |
| - caddy | |
| - nginx | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get all changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46 | |
| with: | |
| files: | | |
| ${{ matrix.webserver }}/** | |
| - name: Checkout example repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: shopwareLabs/example-docker-repository | |
| - name: Build main branch | |
| if: github.ref == 'refs/heads/main' && (steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| run: docker compose build --build-arg BASE_IMAGE=ghcr.io/shopware/docker-base:8.3-caddy | |
| - name: Build PR | |
| if: github.ref != 'refs/heads/main' && (steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| run: docker compose build --build-arg BASE_IMAGE=ghcr.io/shopware/docker-base-ci-test:${{ github.event.number }}-8.3-${{ matrix.webserver}} | |
| - name: Run image | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: docker compose up -d --wait | |
| - name: Wait for Webserver reachable | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| attempt_counter=0 | |
| max_attempts=5 | |
| until $(curl --output /dev/null --silent --head --fail localhost:8000/admin); do | |
| if [ ${attempt_counter} -eq ${max_attempts} ];then | |
| echo "Max attempts reached" | |
| exit 1 | |
| fi | |
| printf '.' | |
| attempt_counter=$(($attempt_counter+1)) | |
| sleep 5 | |
| done | |
| - name: Check if shopware admin is running | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: curl --fail localhost:8000/admin | |
| - name: Check if shopware is running | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: curl --fail localhost:8000 | |
| # output logs if failed | |
| - name: Output logs | |
| if: always() && (steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| run: docker compose logs |