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

@@ -1,19 +1,14 @@
232623name: Build & Deploy Nightly images
name: Build & Deploy Nightly images
on:
schedule:
- cron: '0 2 * * *'
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
CORE_VERSION: development
WEB_VERSION: devel
FTL_VERSION: development
@@ -22,45 +17,47 @@ jobs:
uses: actions/checkout@v2
with:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b nightly
- name: Run Tests
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:
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b nightly
- 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 }}
run: |
./gh-actions-deploy.sh
build-and-publish:
if: github.event_name != 'pull_request'
needs: test
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Get the tag name
run: |
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: |
CORE_VERSION=development
WEB_VERSION=devel
FTL_VERSION=development
PIHOLE_TAG=nightly
PIHOLE_VERSION=nightly
push: true
tags: |
${{ secrets.DOCKERHUB_USER }}/pihole:nightly

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 }}

View File

@@ -11,25 +11,20 @@ on:
required: true
core:
description: 'Branch or tag of core repo'
required: true
required: false
web:
description: 'Branch or tag of web repo'
required: true
required: false
ftl:
description: 'Branch or tag of ftl repo'
required: true
required: false
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
CORE_VERSION: ${{ github.event.inputs.core }}
WEB_VERSION: ${{ github.event.inputs.web }}
FTL_VERSION: ${{ github.event.inputs.ftl }}
@@ -38,45 +33,42 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b ${{ github.event.inputs.name }}
- name: Run Tests
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:
needs: test
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
-
name: Checkout
uses: actions/checkout@v2
-
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:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b ${{ github.event.inputs.name }}
- name: Download workspace files
uses: actions/download-artifact@v1
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
-
name: Build and push
uses: docker/build-push-action@v2
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 }}
run: |
./gh-actions-deploy.sh
context: .
platforms: linux/amd64,linux/arm64,linux/i386,linux/arm/v7
build-args: |
CORE_VERSION=${{ github.event.inputs.core }}
WEB_VERSION=${{ github.event.inputs.web }}
FTL_VERSION=${{ github.event.inputs.ftl }}
PIHOLE_TAG=${{ github.event.inputs.name }}
PIHOLE_VERSION=${{ github.event.inputs.name }}
push: true
tags: |
${{ secrets.DOCKERHUB_USER }}/pihole:${{ github.event.inputs.name }}