Skip to content

Test

Test #46

Workflow file for this run

name: Test
on: [push, workflow_dispatch]
jobs:
test-public-images:
name: Works with public images
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: ["nginx:1.21.0", ubuntu]
my-image: ["nginx/nginx-ingress:1.12.0", ubuntu]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
- run: ./tests/assert-out-of-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'true'
- run: ./tests/assert-up-to-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'false'
test-private-images:
name: Works with private images
runs-on: ${{ matrix.os }}
# Pass docker/login-action authorization to our custom action. See https://github.com/docker/login-action/issues/32 and https://github.com/docker/login-action/issues/34.
env:
DOCKER_CONFIG: $HOME/.docker
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image:
["alpine:3.13", "alpine:3.14", "ghcr.io/twiddler/my-alpine:3.13"]
my-image: ["ghcr.io/twiddler/my-alpine:3.13"]
steps:
- uses: actions/checkout@v3
# Refer to https://github.com/docker/login-action on how to use authenticate with your registry.
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
- run: ./tests/assert-out-of-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'true'
- run: ./tests/assert-up-to-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'false'
fail-on-unknown-parent-image:
name: We should fail if we cannot find `parent-image`
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: [qwertzui]
my-image: [alpine, asdfghjk]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
continue-on-error: true
- run: exit 1
shell: bash
if: steps.check.outputs.out-of-date != ''
fail-on-unknown-my-image:
name: We should fail if we cannot find `my-image`
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: [alpine, asdfghjk]
my-image: [qwertzui]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
continue-on-error: true
- run: exit 1
shell: bash
if: steps.check.outputs.out-of-date != ''