mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
actions/upload-artifact requires ACTIONS_RUNTIME_TOKEN which is not available when running workflows locally via act. Skip the upload step in that case to avoid false CI failures. https://chatgpt.com/share/6960147b-4a2c-800f-bb40-0d31bf1ebaa5
136 lines
3.6 KiB
YAML
136 lines
3.6 KiB
YAML
name: Test Infinito.Nexus Deploy (server)
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
|
|
jobs:
|
|
discover:
|
|
name: Discover server apps
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
outputs:
|
|
apps: ${{ steps.discover.outputs.apps }}
|
|
env:
|
|
NIX_CONFIG: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Show Docker version
|
|
run: docker version
|
|
|
|
- name: Install jq
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y jq
|
|
|
|
- name: Discover invokable server apps (JSON)
|
|
id: discover
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
export INFINITO_DISTRO="arch"
|
|
|
|
cleanup() {
|
|
docker compose --profile ci down --remove-orphans -v || true
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
docker compose --profile ci build infinito
|
|
docker compose --profile ci up -d coredns infinito
|
|
|
|
apps_json="$(scripts/tests/discover-server-apps.sh)"
|
|
if [[ -z "${apps_json}" ]]; then
|
|
apps_json="[]"
|
|
fi
|
|
|
|
# Exclude known-flaky/unsupported apps from CI matrix
|
|
# (keep the list explicit and easy to maintain)
|
|
apps_json="$(echo "${apps_json}" | jq -c 'map(select(. != "web-app-oauth2-proxy"))')"
|
|
|
|
echo "apps=${apps_json}" >> "$GITHUB_OUTPUT"
|
|
echo "Discovered apps (filtered): ${apps_json}"
|
|
|
|
test:
|
|
name: "deploy:server app=${{ matrix.app }} (all distros)"
|
|
needs: discover
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 240
|
|
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
app: ${{ fromJson(needs.discover.outputs.apps) }}
|
|
|
|
env:
|
|
NIX_CONFIG: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Show Docker version
|
|
run: docker version
|
|
|
|
- name: Run deploy test (server, per app, all distros)
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
mkdir -p logs
|
|
|
|
app="${{ matrix.app }}"
|
|
distros=(arch debian ubuntu fedora centos)
|
|
|
|
overall_rc=0
|
|
|
|
for distro in "${distros[@]}"; do
|
|
export INFINITO_DISTRO="${distro}"
|
|
|
|
log_file="logs/deploy-server-${distro}-${app}.log"
|
|
|
|
echo "=== $(date -u) ===" | tee "${log_file}"
|
|
echo "Deploy type: server" | tee -a "${log_file}"
|
|
echo "Distro: ${distro}" | tee -a "${log_file}"
|
|
echo "App: ${app}" | tee -a "${log_file}"
|
|
echo | tee -a "${log_file}"
|
|
|
|
{
|
|
echo "--- make down ---"
|
|
make down
|
|
echo
|
|
echo "--- deploy (per app) ---"
|
|
scripts/tests/deploy.sh --type server --app "${app}"
|
|
} 2>&1 | tee -a "${log_file}"
|
|
|
|
rc="${PIPESTATUS[0]}"
|
|
if [[ "${rc}" != "0" ]]; then
|
|
overall_rc=1
|
|
echo "[ERROR] Deploy failed for distro=${distro} app=${app}" | tee -a "${log_file}"
|
|
echo "--- last 200 lines ---" | tee -a "${log_file}"
|
|
tail -n 200 "${log_file}" || true
|
|
echo
|
|
fi
|
|
done
|
|
|
|
exit "${overall_rc}"
|
|
|
|
- name: Upload deploy logs
|
|
if: ${{ always() && env.ACT != 'true' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: deploy-logs-server-${{ matrix.app }}
|
|
path: logs/deploy-server-*-${{ matrix.app }}.log
|
|
if-no-files-found: warn
|
|
retention-days: 14
|