Reduce Test step to only one arch (amd64/buster)

Migrate build and push step to native github actions using docker buildX - which should _hopefully_ resolve #735
Make some adjustments to Dockerfile/build.yml/install.sh to allow both gh-actions-test.sh to build using the test suite, and github actions native commands to build online

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2021-09-12 22:34:24 +01:00
parent 17453166c2
commit 7624fc3d56
6 changed files with 141 additions and 163 deletions

View File

@@ -7,20 +7,12 @@ on:
release:
types: [published]
#env:
# DOCKER_HUB_REPO: pihole
jobs:
test-and-build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ARCH: [amd64, armhf, arm64, i386]
DEBIAN_VERSION: [buster]
env:
ARCH: ${{matrix.ARCH}}
DEBIAN_VERSION: ${{matrix.DEBIAN_VERSION}}
ARCH: amd64
DEBIAN_VERSION: buster
steps:
- name: Checkout Repo
uses: actions/checkout@v2
@@ -28,34 +20,40 @@ jobs:
run: |
echo "Building ${ARCH}-${DEBIAN_VERSION}"
./gh-actions-test.sh
- name: Push the ARCH image
if: github.event_name != 'pull_request'
run: |
. gh-actions-vars.sh
echo "${{ secrets.DOCKERHUB_PASS }}" | docker login --username="${{ secrets.DOCKERHUB_USER }}" --password-stdin
docker push "${ARCH_IMAGE}"
- name: Upload gh-workspace
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
publish:
build-and-publish:
if: github.event_name != 'pull_request'
needs: test
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
-
name: Checkout
uses: actions/checkout@v2
- name: Download workspace files
uses: actions/download-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
- name: Tag and Publish multi-arch images
env:
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
-
name: Get the tag name
run: |
./gh-actions-deploy.sh
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/i386,linux/arm/v7
build-args: |
PIHOLE_TAG=${{ env.TAG }}
PIHOLE_VERSION=${{ env.TAG }}
push: true
tags: |
${{ secrets.DOCKERHUB_USER }}/pihole:${{ env.TAG }}