69 lines
2.9 KiB
YAML
69 lines
2.9 KiB
YAML
name: shared-httpd mod_whp_symlink PR check
|
|
run-name: mod_whp_symlink probe test for ${{ gitea.actor }}
|
|
|
|
## Pull-request gate for the shared-httpd tenant-symlink module. build-push.yaml
|
|
## only runs on trunk (and publishes); this builds the amd64 shared-httpd image
|
|
## locally (nothing is pushed, no secrets) and runs the live probe test against
|
|
## it. WHP_SYMTEST_REQUIRE=1: a missing docker/image or a failed assertion
|
|
## fails the job. Run the same thing locally: docs/shared-httpd-symlink-module.md.
|
|
##
|
|
## Untrusted code: this runs PR-supplied Dockerfile/C source. Gitea has only the
|
|
## shared `ubuntu-latest` runners (no separate label for untrusted jobs), the same
|
|
## ones the publish jobs use, so this job is hardened instead: no secrets and no registry
|
|
## login, `--pull --no-cache`, a per-run image tag, and an `if: always()`
|
|
## cleanup. The publish builds (build-push.yaml) use their own fresh buildx
|
|
## builder with `pull: true` / `no-cache: true`, so nothing built here can be
|
|
## reused by them. Repo setting (maintainer): require approval for PR workflows
|
|
## from forks.
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'src/mod_whp_symlink/**'
|
|
- 'configs/whp-symlink.conf'
|
|
- 'Dockerfile.shared-httpd'
|
|
- 'scripts/tests/whp-symlink-module.test.sh'
|
|
- '.gitea/workflows/shared-httpd-symlink-pr.yaml'
|
|
|
|
jobs:
|
|
Symlink-Module-Probe:
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 40
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Runner images differ on whether they are root and whether sudo exists.
|
|
- name: Install shellcheck
|
|
run: |
|
|
if ! command -v shellcheck >/dev/null 2>&1; then
|
|
(apt-get update && apt-get install -y shellcheck) ||
|
|
(sudo apt-get update && sudo apt-get install -y shellcheck)
|
|
fi
|
|
shellcheck --version
|
|
|
|
- name: Lint the probe test
|
|
run: |
|
|
bash -n scripts/tests/whp-symlink-module.test.sh
|
|
shellcheck -S warning scripts/tests/whp-symlink-module.test.sh
|
|
|
|
- name: Build shared-httpd (amd64, local only, nothing pushed)
|
|
env:
|
|
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
|
run: docker build --pull --no-cache -f Dockerfile.shared-httpd -t "$TAG" .
|
|
|
|
- name: Probe test (fails the job on any failed assertion)
|
|
env:
|
|
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
|
run: WHP_SYMTEST_REQUIRE=1 ./scripts/tests/whp-symlink-module.test.sh "$TAG"
|
|
|
|
- name: Remove this run's image and containers
|
|
if: always()
|
|
env:
|
|
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
|
run: |
|
|
docker ps -aq --filter "ancestor=$TAG" | xargs -r docker rm -f || true
|
|
docker rmi -f "$TAG" || true
|