Remove images after testing #49
Workflow file for this run
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
--- | |
name: Build and test container images | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
create-runners: | |
name: Create self-hosted Actions runners | |
secrets: inherit | |
strategy: | |
fail-fast: false | |
matrix: | |
runner-name: [ | |
actions-runner, | |
avahi, | |
certbot-cloudflare, | |
fullbogons, | |
growatt-ev, | |
iperf2, | |
iperf3, | |
irrd, | |
mdns-reflector, | |
rng-tools, | |
speedtest, | |
stun, | |
telegraf, | |
# verlihub, | |
vyos-release-alert, | |
xteve, | |
yancobat | |
] | |
uses: ./.github/workflows/create-runner.yaml | |
build-setup: | |
name: Set up build environment | |
runs-on: ubuntu-latest | |
outputs: | |
repo-owner: ${{ steps.repo-lowercase.outputs.REPO_OWNER }} | |
steps: | |
- name: Convert repository owner name to lowercase | |
id: repo-lowercase | |
run: | | |
echo "REPO_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT | |
build-test: | |
name: Build and test image | |
runs-on: self-hosted | |
needs: [create-runners, build-setup] | |
strategy: | |
fail-fast: false | |
matrix: | |
container: [ | |
actions-runner, | |
avahi, | |
certbot-cloudflare, | |
fullbogons, | |
growatt-ev, | |
iperf2, | |
iperf3, | |
irrd, | |
mdns-reflector, | |
rng-tools, | |
speedtest, | |
stun, | |
telegraf, | |
# verlihub, | |
vyos-release-alert, | |
xteve, | |
yancobat | |
] | |
steps: | |
# Checkout repository | |
# https://github.com/actions/checkout | |
- name: Checkout repository | |
uses: actions/[email protected] | |
# Set up QEMU | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
# Set up Docker Buildx | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
buildkitd-config-inline: | | |
[registry."docker.io"] | |
mirrors = ["registry-mirror:5000"] | |
[registry."registry-mirror:5000"] | |
http = true | |
driver-opts: | | |
network=mattflix | |
# Build and export image to Docker daemon | |
# https://github.com/docker/build-push-action | |
- name: Build and export to Docker | |
uses: docker/[email protected] | |
with: | |
context: ${{ matrix.container }} | |
load: true | |
tags: "${{ needs.build-setup.outputs.repo-owner }}/${{ matrix.container }}:test" | |
# Test the built image | |
- name: Test image | |
run: | | |
set -ex | |
CONTAINER_ID="$(docker container run --detach --init --rm ${{ needs.build-setup.outputs.repo-owner }}/${{ matrix.container }}:test)" | |
sleep 30 | |
docker container logs $CONTAINER_ID | |
docker container stop $CONTAINER_ID |