mirror of
https://github.com/klutchell/unbound-docker.git
synced 2026-10-17 08:02:53 +00:00
Use meta-docker tags as a test matrix
Signed-off-by: Kyle Harding <kyle@balena.io>
This commit is contained in:
+25
-18
@@ -3,7 +3,7 @@ name: ci
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- "*"
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
@@ -17,6 +17,7 @@ env:
|
||||
jobs:
|
||||
revbot:
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -30,7 +31,6 @@ jobs:
|
||||
echo "::set-output name=new_tag::${new_tag}"
|
||||
|
||||
- uses: rickstaa/action-create-tag@v1
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
tag: "${{ steps.revbot.outputs.new_tag }}"
|
||||
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
rm -rf "${AGENT_TOOLSDIRECTORY}"
|
||||
df --human-readable
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
- name: Login to docker.io
|
||||
uses: docker/login-action@v1
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
@@ -91,12 +91,15 @@ jobs:
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
labels: ${{ needs.docker-meta.outputs.labels }}
|
||||
tags: ${{ needs.docker-meta.outputs.tags }}
|
||||
cache-from: ${{ needs.docker-meta.outputs.tags }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
outputs: type=oci,dest=/tmp/oci.tar
|
||||
cache-to: type=gha,mode=max
|
||||
cache-from: |
|
||||
type=gha
|
||||
${{ needs.docker-meta.outputs.tags }}
|
||||
|
||||
- uses: peter-evans/dockerhub-description@v2
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
@@ -109,11 +112,12 @@ jobs:
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: build
|
||||
needs: [docker-meta,build]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
PLATFORM: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6]
|
||||
tag: ${{ fromJson(needs.docker-meta.outputs.json).tags }}
|
||||
platform: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6]
|
||||
|
||||
steps:
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
@@ -123,19 +127,22 @@ jobs:
|
||||
name: oci
|
||||
path: /tmp
|
||||
|
||||
- name: Load ${{ matrix.PLATFORM }} manifest
|
||||
- name: Load ${{ matrix.platform }} manifest
|
||||
run: |
|
||||
skopeo \
|
||||
--override-os "$(echo ${{ matrix.PLATFORM }} | awk -F '/' '{print $1}')" \
|
||||
--override-arch "$(echo ${{ matrix.PLATFORM }} | awk -F '/' '{print $2}')" \
|
||||
--override-variant "$(echo ${{ matrix.PLATFORM }} | awk -F '/' '{print $3}')" \
|
||||
copy "oci-archive:/tmp/oci.tar" "docker-daemon:${{ github.repository }}:latest"
|
||||
--override-os "$(echo ${{ matrix.platform }} | awk -F '/' '{print $1}')" \
|
||||
--override-arch "$(echo ${{ matrix.platform }} | awk -F '/' '{print $2}')" \
|
||||
--override-variant "$(echo ${{ matrix.platform }} | awk -F '/' '{print $3}')" \
|
||||
copy "oci-archive:/tmp/oci.tar:${{ matrix.tag }}" "docker-daemon:${{ matrix.tag }}"
|
||||
|
||||
- name: Test ${{ matrix.PLATFORM }}
|
||||
- name: Test package version
|
||||
run: |
|
||||
docker run ${{ github.repository }} -v | tee /dev/stderr | grep -q ${{ env.PACKAGE_VERSION }}
|
||||
docker run -d --name sut ${{ github.repository }}
|
||||
docker exec sut dig sigok.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -q NOERROR || { docker logs sut ; exit 1 ; }
|
||||
docker exec sut dig sigfail.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -q SERVFAIL || { docker logs sut ; exit 1 ; }
|
||||
docker run ${{ matrix.tag }} -v | tee /dev/stderr | grep -wq ${{ env.PACKAGE_VERSION }}
|
||||
|
||||
- name: Test package functionality
|
||||
run: |
|
||||
docker run -d --name sut ${{ matrix.tag }}
|
||||
docker exec sut dig sigok.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -wq NOERROR || { docker logs sut ; exit 1 ; }
|
||||
docker exec sut dig sigfail.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -wq SERVFAIL || { docker logs sut ; exit 1 ; }
|
||||
docker logs sut
|
||||
docker rm -f sut
|
||||
|
||||
Reference in New Issue
Block a user