aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDevan Carpenter <devan@taler.net>2024-01-15 11:51:15 -0500
committerDevan Carpenter <devan@taler.net>2024-01-15 12:53:14 -0500
commit579dec5ba4b1e18952cd507078aad349163e1026 (patch)
tree17ee2f1b1e8693dbc245b41d19073c6039d265c3 /contrib
parent8da08fe4205c1e03eec3d4925c598be0b6769ba5 (diff)
ci: move to contrib dir
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ci/Containerfile20
-rwxr-xr-xcontrib/ci/ci.sh29
-rw-r--r--contrib/ci/jobs/0-codespell/config.ini5
-rw-r--r--contrib/ci/jobs/0-codespell/dictionary.txt20
-rwxr-xr-xcontrib/ci/jobs/0-codespell/job.sh6
-rwxr-xr-xcontrib/ci/jobs/1-build/build.sh6
-rwxr-xr-xcontrib/ci/jobs/1-build/job.sh6
-rwxr-xr-xcontrib/ci/jobs/2-docs/docs.sh8
-rwxr-xr-xcontrib/ci/jobs/2-docs/job.sh6
9 files changed, 106 insertions, 0 deletions
diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile
new file mode 100644
index 000000000..39bd740a9
--- /dev/null
+++ b/contrib/ci/Containerfile
@@ -0,0 +1,20 @@
+FROM docker.io/library/node:18-slim
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update -yq && \
+ apt-get install -yqq \
+ git \
+ python3 \
+ codespell \
+ python3-distutils \
+ make \
+ zip \
+ jq
+
+RUN npm install -g pnpm
+
+# Set our workdir. All subsequent commands will be relative to this path.
+WORKDIR /workdir
+
+CMD ["bash", "/workdir/ci/ci.sh"]
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh
new file mode 100755
index 000000000..fc523d8f5
--- /dev/null
+++ b/contrib/ci/ci.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -evuo pipefail
+
+# Use podman if available, otherwise use docker.
+# Fails if neither is found in PATH
+OCI_RUNTIME=$(which podman || which docker)
+REPO_NAME=$(basename "${PWD}")
+JOB_NAME="${1}"
+JOB_CONTAINER=$((grep CONTAINER_NAME ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${REPO_NAME}")
+
+echo "${JOB_CONTAINER}"
+
+if [ "${JOB_CONTAINER}" = "${REPO_NAME}" ] ; then
+ "${OCI_RUNTIME}" build \
+ -t "${JOB_CONTAINER}" \
+ -f ci/Containerfile .
+fi
+
+"${OCI_RUNTIME}" run \
+ --rm \
+ -ti \
+ --volume "${PWD}":/workdir \
+ --workdir /workdir \
+ "${JOB_CONTAINER}" \
+ ci/jobs/"${JOB_NAME}"/job.sh
+
+top_dir=$(dirname "${BASH_SOURCE[0]}")
+
+#"${top_dir}"/build.sh
diff --git a/contrib/ci/jobs/0-codespell/config.ini b/contrib/ci/jobs/0-codespell/config.ini
new file mode 100644
index 000000000..1c52b6a1a
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/config.ini
@@ -0,0 +1,5 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = False
+CONTAINER_NAME = nixery.dev/shell/codespell
diff --git a/contrib/ci/jobs/0-codespell/dictionary.txt b/contrib/ci/jobs/0-codespell/dictionary.txt
new file mode 100644
index 000000000..aeace0e9e
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/dictionary.txt
@@ -0,0 +1,20 @@
+# List of "words" that codespell should ignore in our sources.
+#
+# Note: The word sensitivity depends on how the to-be-ignored word is
+# spelled in codespell_lib/data/dictionary.txt. F.e. if there is a word
+# 'foo' and you add 'Foo' _here_, codespell will continue to complain
+# about 'Foo'.
+#
+aci
+cant
+ect
+fo
+som
+te
+ths
+updateing
+vie
+zar
+nam
+pares
+kwanza
diff --git a/contrib/ci/jobs/0-codespell/job.sh b/contrib/ci/jobs/0-codespell/job.sh
new file mode 100755
index 000000000..9271343e6
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/job.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+codespell -q 0 -I "${job_dir}"/dictionary.txt -S "*.bib,*.bst,*.cls,*.json,*.png,*.svg,*.wav,*.gz,*/templating/test?/**,**/auditor/*.sql,**/templating/mustach**,*.fees,*key,*.tag,*.info,*.latexmkrc,*.ecc,*.jpg,*.zkey,*.sqlite,*/contrib/hellos/**,*/vpn/tests/**,*.priv,*.file,*.tgz,*.woff,*.gif,*.odt,*.fee,*.deflate,*.dat,*.jpeg,*.eps,*.odg,*/m4/ax_lib_postgresql.m4,*/m4/libgcrypt.m4,*.rpath,config.status,ABOUT-NLS,*/doc/texinfo.tex,*.PNG,*.??.json,*.docx,*.ods,*.doc,*.docx,*.xcf,*.xlsx,*.ecc,*.ttf,*.woff2,*.eot,*.ttf,*.eot,*.mp4,*.pptx,*.epgz,*.min.js,**/*.map,**/fonts/**,*.pack.js,*.po,*.bbl,*/afl-tests/*,*/.git/**,*.pdf,*.epub,**/signing-key.asc,**/pnpm-lock.yaml,**/*.svg,**/*.cls,**/rfc.bib,**/*.bst,*/cbdc-es.tex,*/cbdc-it.tex,**/ExchangeSelection/example.ts,*/testcurl/test_tricky.c,*/i18n/strings.ts,*/src/anastasis-data.ts,**/doc/flows/main.de.tex,*/vendor/**,*/node_modules/**,*.pnpm-store/**"
diff --git a/contrib/ci/jobs/1-build/build.sh b/contrib/ci/jobs/1-build/build.sh
new file mode 100755
index 000000000..25a38946d
--- /dev/null
+++ b/contrib/ci/jobs/1-build/build.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+./bootstrap
+./configure --prefix=$HOME/local/
+make
diff --git a/contrib/ci/jobs/1-build/job.sh b/contrib/ci/jobs/1-build/job.sh
new file mode 100755
index 000000000..8d79902c5
--- /dev/null
+++ b/contrib/ci/jobs/1-build/job.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+"${job_dir}"/build.sh
diff --git a/contrib/ci/jobs/2-docs/docs.sh b/contrib/ci/jobs/2-docs/docs.sh
new file mode 100755
index 000000000..ee6abc2ac
--- /dev/null
+++ b/contrib/ci/jobs/2-docs/docs.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -exuo pipefail
+
+./bootstrap
+./configure
+make
+
+pnpm run typedoc
diff --git a/contrib/ci/jobs/2-docs/job.sh b/contrib/ci/jobs/2-docs/job.sh
new file mode 100755
index 000000000..a72bca4ba
--- /dev/null
+++ b/contrib/ci/jobs/2-docs/job.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+"${job_dir}"/docs.sh