From 006382e695548fdb082e39ad311d0de9c13c4579 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 16 Sep 2026 00:52:51 +0200 Subject: [PATCH] ci: align renderer checks with portable runtime --- Jenkinsfile | 77 +++++++++++++++---------------------------------- tools/render.sh | 3 +- 2 files changed, 24 insertions(+), 56 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5562c79..be4a1db 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,62 +1,40 @@ -// Add this webhook in Gitea: -// http://192.168.1.37:8080/gitea-webhook/post - pipeline { agent { label 'rust_no_docker' } - options { disableConcurrentBuilds() } - - environment { - CARGO_TERM_COLOR = 'always' - - // Reserved for future generated CI artifacts. - CI_ARTIFACT_DIR = '.ci-artifacts' + options { + disableConcurrentBuilds() + skipDefaultCheckout(true) } stages { stage('Checkout') { - steps { - checkout scm - } + steps { checkout scm } } stage('Validate Repository') { steps { sh ''' set -eu - - echo "Validating Reportist repository..." - test -f README.md test -f LICENSE - test -f AGENT.md - - echo "Repository structure OK." - ''' - } - } - - stage('Validate Contract') { - steps { - sh ''' - set -eu - command -v uv >/dev/null 2>&1 || { echo "uv is required for the isolated validation environment" >&2; exit 1; } - uv venv --python 3.11 --allow-existing .ci-venv - uv pip sync --python .ci-venv/bin/python requirements.txt - .ci-venv/bin/python --version - command -v typst >/dev/null 2>&1 || { echo "Typst is required for renderer tests" >&2; exit 1; } + test -f Makefile + test -f schema/report.schema.json + test -x tools/render.sh + test -x tools/validate.sh + command -v make >/dev/null 2>&1 + command -v jq >/dev/null 2>&1 + command -v typst >/dev/null 2>&1 + command -v uv >/dev/null 2>&1 + jq --version typst --version - make test + uv --version ''' } } - /* - * No deployment stage is currently intended. - * - * Reportist is a renderer/tool, not the owner of published - * Beffroi reports. - */ + stage('Test') { + steps { sh 'make test' } + } } post { @@ -64,40 +42,31 @@ pipeline { publishChecks( conclusion: 'SUCCESS', name: 'Reportist CI', - summary: 'Reportist passed all currently implemented CI checks.', - text: 'Schema validation, generic PDF rendering, branding, pagination, asset safety, and standalone-copy checks passed.', + summary: 'All report validation and rendering checks passed.', + text: 'Contracts, YAML and JSON input, branding, assets, pagination, and standalone rendering passed.', title: 'Reportist CI passed' ) - echo '✅ Reportist CI passed.' } - failure { publishChecks( conclusion: 'FAILURE', name: 'Reportist CI', - summary: 'Reportist failed CI.', - text: 'A repository or validation check failed. Check the Jenkins log.', + summary: 'A validation or rendering check failed.', + text: 'Review the Jenkins log for the failing contract, asset, Typst, or PDF check.', title: 'Reportist CI failed' ) - echo '❌ Reportist CI failed.' } - unstable { publishChecks( conclusion: 'ACTION_REQUIRED', name: 'Reportist CI', - summary: 'Reportist CI is unstable.', - text: 'The Jenkins build completed with an unstable status.', + summary: 'The Reportist build is unstable.', + text: 'Review the Jenkins log for unstable checks.', title: 'Reportist CI unstable' ) - echo '⚠️ Reportist CI is unstable.' } - - always { - echo 'CI finished.' - } } } diff --git a/tools/render.sh b/tools/render.sh index f3524d4..b389ba6 100755 --- a/tools/render.sh +++ b/tools/render.sh @@ -22,7 +22,7 @@ input=$(realpath "$input") [[ -f "$input" ]] || fail "$input: report does not exist" "$root/tools/validate.sh" "$input" >/dev/null || fail "invalid report" if [[ -z "$output" ]]; then output=${input%.*}.pdf; fi -output=$(realpath -m "$output") +output_parent=$(dirname "$output"); mkdir -p "$output_parent"; output=$(cd "$output_parent" && pwd -P)/$(basename "$output") [[ "$input" != "$output" ]] || fail "input and output paths must differ" if [[ -e "$output" && "$force" == false ]]; then fail "$output: output exists; use --force to replace it"; fi @@ -51,7 +51,6 @@ if [[ "$logo" != null ]]; then cp -- "$cursor" "$stage/$logo" fi -mkdir -p "$(dirname "$output")" if ! "$typst_command" compile --root "$stage" --input "report=report.$format" --input "format=$format" \ "$stage/report.typ" "$stage/report.pdf"; then fail "invalid report or Typst rendering failed"