Skip to content

docs: Document the e2e hook test harness #3

docs: Document the e2e hook test harness

docs: Document the e2e hook test harness #3

Workflow file for this run

name: E2E hook tests
on:
merge_group:
pull_request:
push:
branches-ignore:
- dependabot/** # Dependabot always creates PRs
- renovate/** # Our Renovate setup always creates PRs
- gh-readonly-queue/** # Temporary merge queue-related GH-made branches
- pre-commit-ci-update-config # pre-commit.ci always creates a PR
permissions:
contents: read
concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-${{
github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
e2e:
name: Run e2e hook tests
runs-on: ubuntu-latest
timeout-minutes: 10
# The published image bundles every tool the hooks need (terraform,
# hcledit, pre-commit, git, ...). Hook and test code come from the checkout
# below, so the image tag only needs to provide tooling, not be in sync.
env:
IMAGE: ghcr.io/antonbabenko/pre-commit-terraform:latest
steps:
- name: Check out src from Git
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Pull the multi-tool image
run: docker pull "${IMAGE}"
# Checkout happens on the host (needs Node for the JS action); the tests
# run inside the image, which the alpine-based image can't host directly.
- name: Run e2e tests inside the image
run: >-
docker run --rm
--volume "${GITHUB_WORKSPACE}:/lint"
--workdir /lint
--entrypoint bash
"${IMAGE}"
tests/e2e/run_e2e_tests.sh