Skip to content

Execute Goss tests

Execute Goss tests #14

Workflow file for this run

name: goss-tests
run-name: Execute Goss tests
env:
REGISTRY: ghcr.io
on:
workflow_run:
workflows: ["Build and deploy Bay images"]
types: [completed]
workflow_dispatch:
push:
jobs:
goss-test:
runs-on: ubuntu-latest
strategy:
matrix:
images: ["bay-php_goss"]
type:
- php
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }}
tags: |
type=ref,event=branch
- name: Clean ref_name
id: sanitise-ref-name
run: |
echo "SANITISED-REF-NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v4
with:
push: false
context: ./images/bay-php_goss
build-args: |
BASE_IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/php-cli:${{ steps.sanitise-ref-name.outputs.SANITISED-REF-NAME }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install Goss
uses: e1himself/[email protected]
- name: Execute Goss tests
working-directory: ./tests
run: |
ls -al .
GOSS_FILES_STRATEGY=cp GOSS_FILE=goss.${{ matrix.type }}_goss.yaml bash -c 'dgoss run -i ${{ steps.meta.outputs.tags }}'