Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/workflows/build.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Push Docker Image

on:
pull_request:
push:
branches:
- main
- staging
workflow_dispatch:

concurrency:
group: docker-build-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write

jobs:
build-and-push:
name: PHP ${{ matrix.php-version }}${{ matrix.image.suffix }}
strategy:
fail-fast: false
matrix:
php-version: ['8.3', '8.4']
image:
# Full pipe image (last Dockerfile stage)
- target: ''
suffix: ''
# Runtime-only image for CLI tools / IDE integrations
- target: standards-runtime
suffix: '-runtime'
uses: aligent/workflows/.github/workflows/docker-build.yml@main
with:
image-name: aligent/code-standards-pipe-php
target: ${{ matrix.image.target }}
# Only main/staging publish; pull requests and manual runs on other branches just build
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' }}
build-args: |
PHP_VERSION=${{ matrix.php-version }}
ALPINE_VERSION=${{ vars.ALPINE_VERSION }}
# Tags: 8.4, 8.4-runtime (main); 8.4-experimental, 8.4-runtime-experimental (staging)
tags: |
type=raw,value=${{ matrix.php-version }}${{ matrix.image.suffix }}${{ github.ref_name == 'staging' && '-experimental' || '' }}
# Separate cache scope per matrix entry so builds don't overwrite each other's cache
cache-from: type=gha,scope=php-${{ matrix.php-version }}${{ matrix.image.suffix }}
cache-to: type=gha,mode=max,scope=php-${{ matrix.php-version }}${{ matrix.image.suffix }}
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add the following your `bitbucket-pipelines.yml` file:
- step:
name: "Code Standards check"
script:
- pipe: docker://aligent/code-standards-pipe-php:8.2
- pipe: docker://ghcr.io/aligent/code-standards-pipe-php:8.4
variables:
STANDARDS: "Magento2"
SKIP_DEPENDENCIES: "true"
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
with:
fetch-depth: 0
- name: Code Standards Test
uses: docker://aligent/code-standards-pipe-php:8.1
uses: docker://ghcr.io/aligent/code-standards-pipe-php:8.4
env:
STANDARDS: "Magento2"
SKIP_DEPENDENCIES: "true"
Expand All @@ -64,8 +64,21 @@ An intermediate build target `standards-runtime` is available which does not inc

The following command can be used to invoke the pipe locally:
```
docker run -v $PWD:/build --workdir=/build aligent/code-standards-pipe-php:<PHP_VERSION>
docker run -v $PWD:/build --workdir=/build ghcr.io/aligent/code-standards-pipe-php:<PHP_VERSION>
```

Commits published to the `main` branch will trigger an automated build for the each of the configured PHP version.
Commits to `staging` will do the same but image tags will be suffixed with `-experimiental`.
## CI/CD

Docker images are built and pushed to GitHub Container Registry (`ghcr.io/aligent/code-standards-pipe-php`) via GitHub Actions
(`.github/workflows/docker-build.yml`, using the shared `aligent/workflows` Docker build workflow). The workflow:

- Builds every configured PHP version, as both the full pipe image (`<PHP_VERSION>`) and the `standards-runtime` target (`<PHP_VERSION>-runtime`)
- Pushes images on commits to `main`; commits to `staging` push tags suffixed with `-experimental`
- Builds without pushing on pull requests
- Can be triggered manually

### Required Variables

| Variable | Description |
|----------|-------------|
| `ALPINE_VERSION` | Alpine version of the upstream `php:<PHP_VERSION>-alpine<ALPINE_VERSION>` image. The build fails if it is not set. |
6 changes: 0 additions & 6 deletions hooks/build

This file was deleted.

Loading