mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2026-04-21 17:29:12 +01:00
ci: replace Python test suite with BATS and consolidate workflows
Replace the pytest/testinfra/tox test stack with BATS, aligning with the approach used in the FTL repository. - Merge build-and-test.yml into build-and-publish.yml; the combined lint+test job now runs on pull_request via a single bash test/run.sh call, removing the need for Python/tox in CI - Replace Python test files with test/run.sh and test/test_suite.bats - test/run.sh handles image build, BATS install, container lifecycle, and cleanup via trap in one place - Containers consolidated from 6 to 2 (CONTAINER_DEFAULT and CONTAINER_CUSTOM), removing tests that belong to FTL's own suite - Tests now focus on Docker-specific behaviour: entrypoint, signal handling, UID/GID mapping, cron setup, and password assignment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
35
.github/workflows/build-and-publish.yml
vendored
35
.github/workflows/build-and-publish.yml
vendored
@@ -16,7 +16,39 @@ env:
|
||||
components_branch: ${{ github.event_name == 'release' && 'master' || 'development' }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
- platform: linux/386
|
||||
runner: ubuntu-latest
|
||||
- platform: linux/arm/v6
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/arm/v7
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/riscv64
|
||||
runner: ubuntu-24.04-arm
|
||||
env:
|
||||
CI_ARCH: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a #v4.0.0
|
||||
|
||||
- name: Test
|
||||
run: CIPLATFORM=${{ env.CI_ARCH }} bash test/run.sh
|
||||
|
||||
build-prepare:
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
components_branch: ${{ env.components_branch }}
|
||||
@@ -25,6 +57,7 @@ jobs:
|
||||
- run: echo "Exposing env vars for reusable workflow"
|
||||
|
||||
build:
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/github-builder/.github/workflows/build.yml@v1
|
||||
needs:
|
||||
- build-prepare
|
||||
@@ -45,7 +78,7 @@ jobs:
|
||||
WEB_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
|
||||
PADD_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
|
||||
platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64,linux/riscv64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: true
|
||||
set-meta-labels: true
|
||||
meta-images: |
|
||||
pihole/pihole
|
||||
|
||||
54
.github/workflows/build-and-test.yml
vendored
54
.github/workflows/build-and-test.yml
vendored
@@ -1,54 +0,0 @@
|
||||
name: Build Image and Test
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
- platform: linux/386
|
||||
runner: ubuntu-latest
|
||||
- platform: linux/arm/v6
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/arm/v7
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
- platform: linux/riscv64
|
||||
runner: ubuntu-24.04-arm
|
||||
env:
|
||||
CI_ARCH: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a #v4.0.0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Run black formatter
|
||||
run: |
|
||||
pip install black
|
||||
black --check --diff test/tests/
|
||||
|
||||
- name: Install wheel
|
||||
run: pip install wheel
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r test/requirements.txt
|
||||
|
||||
- name: Test with tox
|
||||
run: |
|
||||
CIPLATFORM=${{ env.CI_ARCH }} tox -c test/tox.ini
|
||||
Reference in New Issue
Block a user