From fc819f9980ee8e9f95f49397b2fadcda06a60b7b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 12 Oct 2023 17:13:20 -0400 Subject: gitlab ci for a basic test This test just tries to make sure reindex has been run, and that mdbook passes. --- .gitlab-ci.yml | 8 ++++++++ build_html.sh | 4 +--- proposals/check_index | 22 ++++++++++++++++++++++ proposals/reindex.py | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 proposals/check_index diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1e8864d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ + +check: + # Chosen more or less arbitrarily. + image: hrektts/mdbook + script: + - apt-get update && apt-get install -y python3 git + - ./proposals/check_index + - ./build_html.sh diff --git a/build_html.sh b/build_html.sh index ae78080..cb33660 100755 --- a/build_html.sh +++ b/build_html.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e -u -o pipefail +set -e -u -o pipefail -x TOPLEVEL=$(realpath $(dirname "$0")) cd "${TOPLEVEL}/proposals" @@ -11,5 +11,3 @@ mdbook build cd "${TOPLEVEL}/mdbook/proposals" mdbook build - - diff --git a/proposals/check_index b/proposals/check_index new file mode 100755 index 0000000..61db50d --- /dev/null +++ b/proposals/check_index @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Give an error if somebody forgot to run ./reindex.py. +# +# Only works on a clean git checkout. + +set -e -u -o pipefail -x + +TOPLEVEL=$(dirname "$0")/.. + +if ! git diff --quiet ; then + echo "Git repository is not clean. Cannot procede." + exit 2 +fi + +cd "$TOPLEVEL/proposals" +./reindex.py + +if ! git diff --quiet ; then + echo "Proposal index is not up-to-date. Run ./reindex.py to regenerate it." >&2 + exit 1 +fi diff --git a/proposals/reindex.py b/proposals/reindex.py index 476ed19..8bc9729 100755 --- a/proposals/reindex.py +++ b/proposals/reindex.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys if sys.version_info[0] < 3: -- cgit v1.2.3-54-g00ecf