-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multi-arch support for images (#61)
* Add multi-arch amd64, arm64 support for images * Update README.md * New workflows for CI/CD to automatically push Architecture builds on tagged releases Authored-by: Brett Tasker (brettt89)
- Loading branch information
Showing
10 changed files
with
399 additions
and
95 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Build & Test | ||
description: "Builds and tests the docker images" | ||
inputs: | ||
php: | ||
required: true | ||
description: "PHP Version" | ||
distro: | ||
required: true | ||
description: "PHP Distribution (e.g. apache, fpm, cli)" | ||
os: | ||
required: true | ||
description: "Debian Operating System Distribution" | ||
framework: | ||
required: true | ||
description: "Silverstripe CMS Recipe Version" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Build Images | ||
env: | ||
TAG: ${{ inputs.php }}-${{ inputs.distro }}-${{ inputs.os }} | ||
BUILD_DIR: src/${{ inputs.php }}/${{ inputs.distro }}/${{ inputs.os }} | ||
run: docker-compose build | ||
shell: bash | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-data | ||
run: | | ||
echo "::set-output name=dir::$(composer config --global data-dir)" | ||
shell: bash | ||
|
||
- name: Cache Composer Downloads | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-data.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ inputs.framework }}-${{ inputs.php }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ inputs.framework }} | ||
- name: Create Silverstripe ${{ inputs.framework }} test project | ||
env: | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: | | ||
docker-compose run composer config -g platform.php ${{ inputs.php }} | ||
docker-compose run composer config -g platform.ext-intl 1 | ||
docker-compose run composer config -g --no-interaction allow-plugins.composer/installers true | ||
docker-compose run composer create-project --no-interaction --no-dev silverstripe/installer . ^${{ inputs.framework }} | ||
shell: bash | ||
|
||
- name: Run tests | ||
env: | ||
TAG: ${{ inputs.php }}-${{ inputs.distro }}-${{ inputs.os }} | ||
run: docker-compose run sut | ||
shell: bash | ||
|
||
- name: The job has failed | ||
if: ${{ failure() }} | ||
run: | | ||
docker-compose logs | ||
shell: bash | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Release | ||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- '*' # Push events to every tag not containing / | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [bullseye, buster, alpine] | ||
php: ['7.4', '8.0', '8.1'] | ||
distro: [apache, fpm, cli] | ||
exclude: | ||
- os: alpine | ||
distro: apache | ||
include: | ||
- os: bullseye | ||
additional_distro: true | ||
- os: bullseye | ||
distro: apache | ||
additional_php: true | ||
- os: bullseye | ||
php: 8.1 | ||
distro: apache | ||
latest: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- id: test | ||
uses: ./.github/actions/build-test | ||
with: | ||
php: ${{ matrix.php }} | ||
distro: ${{ matrix.distro }} | ||
os: ${{ matrix.os }} | ||
framework: 4 | ||
|
||
- name: Populate Default Tag | ||
run: | | ||
echo "docker_tags=brettt89/silverstripe-web:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}" >> $GITHUB_ENV | ||
- if: ${{ matrix.additional_distro }} | ||
name: Populate Additional Distro Tag | ||
run: | | ||
echo "docker_tags=${{ env.docker_tags }},brettt89/silverstripe-web:${{ matrix.php }}-${{ matrix.distro }}" >> $GITHUB_ENV | ||
- if: ${{ matrix.additional_php }} | ||
name: Populate Additional PHP Tag | ||
run: | | ||
echo "docker_tags=${{ env.docker_tags }},brettt89/silverstripe-web:${{ matrix.php }}" >> $GITHUB_ENV | ||
- if: ${{ matrix.latest }} | ||
name: Populate Latest Tag | ||
run: | | ||
echo "docker_tags=${{ env.docker_tags }},brettt89/silverstripe-web:latest" >> $GITHUB_ENV | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: src/${{ matrix.php }}/${{ matrix.distro }}/${{ matrix.os }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ env.docker_tags }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: GitHub CI | ||
on: | ||
pull_request: | ||
# Pattern matched against changes to src/, test/ and .github/ | ||
paths: | ||
- 'src/**' | ||
- 'tests/**' | ||
- '.github/**' | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [bullseye, buster, alpine] | ||
php: ['7.4', '8.0', '8.1'] | ||
framework: [3, 4] | ||
distro: [apache, fpm, cli] | ||
exclude: | ||
- os: alpine | ||
distro: apache | ||
- php: 8.0 | ||
framework: 3 | ||
- php: 8.1 | ||
framework: 3 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- id: test | ||
uses: ./.github/actions/build-test | ||
with: | ||
php: ${{ matrix.php }} | ||
distro: ${{ matrix.distro }} | ||
os: ${{ matrix.os }} | ||
framework: ${{ matrix.framework }} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Development of `brettt89/silverstripe-docker` images | ||
|
||
This repository has been setup to use Github Actions to automatically test and release new builds using Git functionality. These instructions can be found in the `.github/` directory. | ||
|
||
`develop.yml` contains Development tests which are run on every pull-request that contains changes to files in `src/`, `tests/` or `.github/`. These tests run a Silverstripe website (Both CMS 3 and CMS 4) on each image and confirms image is working as expected by executing a `dev/build` against the installation. | ||
|
||
`deploy.yml` contains the Release process which is run when a new "tag" is created. Upon the tag being created, this workflow will perform a final Silverstripe CMS application test (Framework 4 only) on each Image before building all images across defined architectures (e.g. `amd64`, `arm64`). If these builds succeed, they are automatically pushed up to DockerHub as part of the CI/CD process. | ||
|
||
## Making Changes | ||
|
||
All changes should be submitted via Pull Requests to ensure development tests are executed for any changes made. This ensures that full test suite is executed against your changes before any release is made. | ||
|
||
## Creating Releases | ||
|
||
Releases can be triggerred by creation of a new tag/release on the repository. These tags/releases should *only* be created on the `master` branch for continuity. | ||
|
||
>NOTE: The Release process will ignore tags that have `/` characters in them (E.g. The tag `3.1.2/beta` would be ignored). |
Oops, something went wrong.