feat: add automated tests for bash scripts #27
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
--- | |
name: Docker Image PHP-FPM Rootless Magento 2 Web | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: [ "Docker Image PHP-FPM Rootless Magento 2" ] | |
branches: [ main ] | |
types: | |
- completed | |
pull_request: | |
push: | |
paths: | |
- images/php-fpm-rootless/magento2-web/.trigger | |
branches: | |
- main | |
jobs: | |
tests: | |
name: "Run tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Install bashunit" | |
run: | | |
curl -s https://bashunit.typeddevs.com/install.sh | bash -s -- /usr/local/bin | |
- name: "Test" | |
run: 'find images/php-fpm-rootless/magento2-web/ -name "*_test.sh" -type f -print0 | xargs -0 -t bashunit' | |
php-fpm-rootless-magento2-web: | |
name: php-fpm-rootless/magento2-web | |
needs: [ tests ] | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
strategy: | |
matrix: | |
BASE_IMAGE_NAME: [ "debian", "ubuntu" ] | |
BASE_IMAGE_TAG: [ "bullseye", "bookworm", "jammy" ] | |
PHP_VERSION: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" ] | |
exclude: | |
# Exclude PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 on Debian Bookworm | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "5.6" | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "7.0" | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "7.1" | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "7.2" | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "7.3" | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bookworm | |
PHP_VERSION: "7.4" | |
# jammy is an ubuntu distro | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: jammy | |
# bullseye and bookworm are debian distros | |
- BASE_IMAGE_NAME: ubuntu | |
BASE_IMAGE_TAG: bullseye | |
- BASE_IMAGE_NAME: ubuntu | |
BASE_IMAGE_TAG: bookworm | |
# debian-bullseye images are the default and will be built with and without '-debian-bullseye' suffix | |
include: | |
- BASE_IMAGE_NAME: debian | |
BASE_IMAGE_TAG: bullseye | |
DEFAULT_IMAGE: "true" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: mirror.gcr.io/tonistiigi/binfmt:latest | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: image=moby/buildkit:master | |
config-inline: | | |
[registry."docker.io"] | |
mirrors = ["${{ secrets.DOCKER_PROXY }}"] | |
- uses: supplypike/setup-bin@v3 | |
with: | |
uri: https://github.com/hairyhenderson/gomplate/releases/latest/download/gomplate_linux-amd64 | |
name: gomplate | |
version: latest | |
- name: Generate Dockerfile | |
run: gomplate -f images/php-fpm-rootless/magento2-web/tpl.Dockerfile -o images/php-fpm-rootless/magento2-web/Dockerfile | |
env: | |
BASE_IMAGE_NAME: ${{ matrix.BASE_IMAGE_NAME }} | |
BASE_IMAGE_TAG: ${{ matrix.BASE_IMAGE_TAG }} | |
- name: Build and push default image | |
uses: docker/build-push-action@v5 | |
if: ${{ matrix.DEFAULT_IMAGE == 'true' }} | |
with: | |
context: images/php-fpm-rootless/magento2-web/context | |
file: images/php-fpm-rootless/magento2-web/Dockerfile | |
push: true | |
platforms: "linux/amd64,linux/arm64" | |
tags: | | |
${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-rootless | |
${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
build-args: PHP_VERSION=${{ matrix.PHP_VERSION }} | |
cache-from: type=registry,ref=${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
cache-to: type=inline | |
- name: Build and push default image | |
uses: docker/build-push-action@v5 | |
if: ${{ matrix.DEFAULT_IMAGE != 'true' }} | |
with: | |
context: images/php-fpm-rootless/magento2-web/context | |
file: images/php-fpm-rootless/magento2-web/Dockerfile | |
push: true | |
platforms: "linux/amd64,linux/arm64" | |
tags: | | |
${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
build-args: PHP_VERSION=${{ matrix.PHP_VERSION }} | |
cache-from: type=registry,ref=${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
cache-to: type=inline | |
# php-fpm-rootless-magento2-web-apps: | |
# name: php-fpm-rootless/magento2-web-apps | |
# runs-on: ubuntu-latest | |
# if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
# needs: | |
# - php-fpm-rootless-magento2-web | |
# strategy: | |
# matrix: | |
# BASE_IMAGE_NAME: [ "debian", "ubuntu" ] | |
# BASE_IMAGE_TAG: [ "bullseye", "bookworm", "jammy" ] | |
# PHP_VERSION: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" ] | |
# APP: [ "blackfire", "spx", "xdebug2", "xdebug3" ] | |
# exclude: | |
# # Exclude PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 on Debian Bookworm | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "5.6" | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "7.0" | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "7.1" | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "7.2" | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "7.3" | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bookworm | |
# PHP_VERSION: "7.4" | |
# | |
# # jammy is an ubuntu distro | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: jammy | |
# | |
# # bullseye and bookworm are debian distros | |
# - BASE_IMAGE_NAME: ubuntu | |
# BASE_IMAGE_TAG: bullseye | |
# - BASE_IMAGE_NAME: ubuntu | |
# BASE_IMAGE_TAG: bookworm | |
# | |
# # exclude xdebug2 on php 8.0, 8.1, 8.2, 8.3 | |
# - PHP_VERSION: "8.0" | |
# APP: "xdebug2" | |
# - PHP_VERSION: "8.1" | |
# APP: "xdebug2" | |
# - PHP_VERSION: "8.2" | |
# APP: "xdebug2" | |
# - PHP_VERSION: "8.3" | |
# APP: "xdebug2" | |
# | |
# # debian-bullseye images are the default and will be built with and without '-debian-bullseye' suffix | |
# include: | |
# - BASE_IMAGE_NAME: debian | |
# BASE_IMAGE_TAG: bullseye | |
# DEFAULT_IMAGE: "true" | |
# steps: | |
# - uses: actions/checkout@v4 | |
# | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
# | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# with: | |
# image: mirror.gcr.io/tonistiigi/binfmt:latest | |
# | |
# - name: Set up Docker Buildx | |
# id: buildx | |
# uses: docker/setup-buildx-action@v3 | |
# with: | |
# driver-opts: image=moby/buildkit:master | |
# config-inline: | | |
# [registry."docker.io"] | |
# mirrors = ["${{ secrets.DOCKER_PROXY }}"] | |
# | |
# - uses: supplypike/setup-bin@v3 | |
# with: | |
# uri: https://github.com/hairyhenderson/gomplate/releases/latest/download/gomplate_linux-amd64 | |
# name: gomplate | |
# version: latest | |
# | |
# - name: Generate Dockerfile | |
# run: gomplate -f images/php-fpm-rootless/${{ matrix.APP }}/tpl.Dockerfile -o images/php-fpm-rootless/${{ matrix.APP }}/Dockerfile | |
# env: | |
# BASE_IMAGE_NAME: ${{ matrix.BASE_IMAGE_NAME }} | |
# BASE_IMAGE_TAG: ${{ matrix.BASE_IMAGE_TAG }} | |
# PHP_VARIANT: "magento2-web" | |
# | |
# - name: Build and push default image | |
# uses: docker/build-push-action@v5 | |
# if: ${{ matrix.DEFAULT_IMAGE == 'true' }} | |
# with: | |
# context: images/php-fpm-rootless/${{ matrix.APP }}/context | |
# file: images/php-fpm-rootless/${{ matrix.APP }}/Dockerfile | |
# push: true | |
# platforms: "linux/amd64,linux/arm64" | |
# tags: | | |
# ${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.APP }}-rootless | |
# ${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.APP }}-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
# build-args: | | |
# PHP_VERSION=${{ matrix.PHP_VERSION }} | |
# cache-from: type=registry,ref=${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.APP }}-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
# cache-to: type=inline | |
# | |
# - name: Build and push default image | |
# uses: docker/build-push-action@v5 | |
# if: ${{ matrix.DEFAULT_IMAGE != 'true' }} | |
# with: | |
# context: images/php-fpm-rootless/${{ matrix.APP }}/context | |
# file: images/php-fpm-rootless/${{ matrix.APP }}/Dockerfile | |
# push: true | |
# platforms: "linux/amd64,linux/arm64" | |
# tags: | | |
# ${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.APP }}-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
# build-args: | | |
# PHP_VERSION=${{ matrix.PHP_VERSION }} | |
# cache-from: type=registry,ref=${{ vars.DOCKER_REPO }}/php-fpm:${{ matrix.PHP_VERSION }}-magento2-web-${{ matrix.APP }}-${{ matrix.BASE_IMAGE_NAME }}-${{ matrix.BASE_IMAGE_TAG }}-rootless | |
# cache-to: type=inline |