Files
computer-playbook/.github/workflows/test-dns.yml
T
2026-05-22 11:23:25 +02:00

122 lines
3.2 KiB
YAML

name: "💬 Test: DNS"
on:
workflow_dispatch:
inputs:
distros:
description: "Space-separated distro list (e.g. 'arch debian ubuntu')"
required: false
default: "debian"
type: string
workflow_call:
inputs:
distros:
description: "Space-separated distro list"
required: true
type: string
permissions:
contents: read
packages: read
env:
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
jobs:
prepare:
name: 🧮 Build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.out.outputs.matrix }}
owner: ${{ steps.vars.outputs.owner }}
repo_name: ${{ steps.vars.outputs.repo_name }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Resolve image coordinates
id: vars
shell: bash
run: |
set -euo pipefail
owner="$(scripts/meta/resolve/repository/owner.sh)"
repo_name="${{ github.repository }}"
repo_name="${repo_name#*/}"
repo_name="${repo_name,,}"
echo "owner=${owner}" >> "$GITHUB_OUTPUT"
echo "repo_name=${repo_name}" >> "$GITHUB_OUTPUT"
- name: 📦 Install jq
shell: bash
run: ./scripts/install/apt.sh jq
- name: Compute matrix JSON
id: out
shell: bash
run: |
set -euo pipefail
distros="${{ inputs.distros }}"
json="$(scripts/github/runner/distros_matrix.sh "${distros:-debian}")"
echo "matrix=${json}" >> "$GITHUB_OUTPUT"
echo "Using matrix: ${json}"
dns:
name: 🌐 DNS (${{ matrix.distro }})
runs-on: ubuntu-latest
timeout-minutes: 20
needs: prepare
env:
NIX_CONFIG: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
# Use the prebuilt CI image directly instead of the :latest fallback from env/all.sh.
INFINITO_IMAGE: ghcr.io/${{ needs.prepare.outputs.owner }}/${{ needs.prepare.outputs.repo_name }}/${{ matrix.distro }}:ci-${{ github.sha }}
strategy:
fail-fast: false
matrix:
distro: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dnsutils (dig)
shell: bash
run: ./scripts/install/apt.sh dnsutils
- name: Start stack (coredns + infinito) for distro
shell: bash
env:
INFINITO_DISTRO: ${{ matrix.distro }}
run: |
set -euo pipefail
make compose-up
- name: DNS test suite
shell: bash
env:
INFINITO_DISTRO: ${{ matrix.distro }}
run: |
set -euo pipefail
scripts/tests/dns.sh
- name: Dump CoreDNS logs on failure
if: failure()
shell: bash
run: |
docker ps -a || true
docker logs infinito-coredns --tail=200 || true
- name: Dump infinito logs on failure
if: failure()
shell: bash
env:
INFINITO_DISTRO: ${{ matrix.distro }}
run: |
set -euo pipefail
# shellcheck source=scripts/meta/env/load.sh
source scripts/meta/env/load.sh
docker logs "${INFINITO_CONTAINER}" --tail=200 || true