summaryrefslogtreecommitdiff
path: root/contrib/ci
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ci')
-rw-r--r--contrib/ci/Containerfile27
-rwxr-xr-xcontrib/ci/ci.sh34
-rw-r--r--contrib/ci/jobs/0-codespell/config.ini6
-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
-rw-r--r--contrib/ci/jobs/3-wallet-cli-deb-package/config.ini6
-rwxr-xr-xcontrib/ci/jobs/3-wallet-cli-deb-package/job.sh36
-rwxr-xr-xcontrib/ci/jobs/3-wallet-cli-deb-package/version.sh17
-rw-r--r--contrib/ci/jobs/4-taler-harness-deb-package/config.ini6
-rwxr-xr-xcontrib/ci/jobs/4-taler-harness-deb-package/job.sh36
-rwxr-xr-xcontrib/ci/jobs/4-taler-harness-deb-package/version.sh17
-rw-r--r--contrib/ci/jobs/5-deploy-packages/config.ini6
-rwxr-xr-xcontrib/ci/jobs/5-deploy-packages/job.sh14
17 files changed, 257 insertions, 0 deletions
diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile
new file mode 100644
index 000000000..a9da11ae8
--- /dev/null
+++ b/contrib/ci/Containerfile
@@ -0,0 +1,27 @@
+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 \
+ # Debian packaging tools \
+ po-debconf \
+ build-essential \
+ debhelper-compat \
+ devscripts \
+ git-buildpackage \
+ && rm -rf /var/lib/apt/lists/*
+
+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..0719015b9
--- /dev/null
+++ b/contrib/ci/ci.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -exvuo pipefail
+
+# Requires podman
+# Fails if not found in PATH
+OCI_RUNTIME=$(which podman)
+REPO_NAME=$(basename "${PWD}")
+JOB_NAME="${1}"
+JOB_ARCH=$((grep CONTAINER_ARCH contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${2:-amd64}")
+JOB_CONTAINER=$((grep CONTAINER_NAME contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "localhost/${REPO_NAME}:${JOB_ARCH}")
+CONTAINER_BUILD=$((grep CONTAINER_BUILD contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "True")
+
+echo "Image name: ${JOB_CONTAINER}"
+
+if [ "${CONTAINER_BUILD}" = "True" ] ; then
+ "${OCI_RUNTIME}" build \
+ --arch "${JOB_ARCH}" \
+ -t "${JOB_CONTAINER}" \
+ -f contrib/ci/Containerfile .
+fi
+
+"${OCI_RUNTIME}" run \
+ --rm \
+ -ti \
+ --arch "${JOB_ARCH}" \
+ --env CI_COMMIT_REF="$(git rev-parse HEAD)" \
+ --volume "${PWD}":/workdir \
+ --workdir /workdir \
+ "${JOB_CONTAINER}" \
+ contrib/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..bd7d73860
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = False
+CONTAINER_NAME = nixery.dev/shell/codespell
+CONTAINER_ARCH = amd64
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
diff --git a/contrib/ci/jobs/3-wallet-cli-deb-package/config.ini b/contrib/ci/jobs/3-wallet-cli-deb-package/config.ini
new file mode 100644
index 000000000..fe4fd36a6
--- /dev/null
+++ b/contrib/ci/jobs/3-wallet-cli-deb-package/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = True
+CONTAINER_NAME = localhost/wallet-core
+CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/3-wallet-cli-deb-package/job.sh b/contrib/ci/jobs/3-wallet-cli-deb-package/job.sh
new file mode 100755
index 000000000..ac9132929
--- /dev/null
+++ b/contrib/ci/jobs/3-wallet-cli-deb-package/job.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+set -exuo pipefail
+# This file is in the public domain.
+# Helper script to build the latest DEB packages in the container.
+
+
+unset LD_LIBRARY_PATH
+
+# Run the bootstrap script in case it hasn't been done already at this point
+./bootstrap
+
+# gbp wants the debian directory in the root of the git repo
+# so we symlink in the debian directory for the package we want to create
+rm -f ./debian # in case we already have a symlink there
+ln -s packages/taler-wallet-cli/debian .
+
+# Change to our package directory
+cd packages/taler-wallet-cli
+
+# Install build-time dependencies.
+# Update apt cache first
+apt-get update
+apt-get upgrade -y
+mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
+
+export VERSION="$(../../contrib/ci/jobs/3-wallet-cli-deb-package/version.sh)"
+echo "Building package version ${VERSION}"
+
+EMAIL=none gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}"
+echo "Current PWD is $PWD"
+./configure --prefix=$HOME/local/
+dpkg-buildpackage -rfakeroot -b -uc -us
+
+ls -alh ../*.deb
+mkdir -p /artifacts/wallet-core/${CI_COMMIT_REF} # Variable comes from CI environment
+mv ../*.deb /artifacts/wallet-core/${CI_COMMIT_REF}/
diff --git a/contrib/ci/jobs/3-wallet-cli-deb-package/version.sh b/contrib/ci/jobs/3-wallet-cli-deb-package/version.sh
new file mode 100755
index 000000000..52031b23a
--- /dev/null
+++ b/contrib/ci/jobs/3-wallet-cli-deb-package/version.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -ex
+
+BRANCH=$(git name-rev --name-only HEAD)
+if [ -z "${BRANCH}" ]; then
+ exit 1
+else
+ # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
+ git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
+ RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1)
+ commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+ if [ "${commits}" = "0" ]; then
+ git describe --tag HEAD | sed -r 's/^v//' || exit 1
+ else
+ echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
+ fi
+fi
diff --git a/contrib/ci/jobs/4-taler-harness-deb-package/config.ini b/contrib/ci/jobs/4-taler-harness-deb-package/config.ini
new file mode 100644
index 000000000..fe4fd36a6
--- /dev/null
+++ b/contrib/ci/jobs/4-taler-harness-deb-package/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = True
+CONTAINER_NAME = localhost/wallet-core
+CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/4-taler-harness-deb-package/job.sh b/contrib/ci/jobs/4-taler-harness-deb-package/job.sh
new file mode 100755
index 000000000..c58c643e6
--- /dev/null
+++ b/contrib/ci/jobs/4-taler-harness-deb-package/job.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+set -exuo pipefail
+# This file is in the public domain.
+# Helper script to build the latest DEB packages in the container.
+
+
+unset LD_LIBRARY_PATH
+
+# Run the bootstrap script in case it hasn't been done already at this point
+./bootstrap
+
+# gbp wants the debian directory in the root of the git repo
+# so we symlink in the debian directory for the package we want to create
+rm -f ./debian # in case we already have a symlink there
+ln -s packages/taler-harness/debian .
+
+# Change to our package directory
+cd packages/taler-harness
+
+# Install build-time dependencies.
+# Update apt cache first
+apt-get update
+apt-get upgrade -y
+mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
+
+export VERSION="$(../../contrib/ci/jobs/4-taler-harness-deb-package/version.sh)"
+echo "Building package version ${VERSION}"
+
+EMAIL=none gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}"
+echo "Current PWD is $PWD"
+./configure --prefix=$HOME/local/
+dpkg-buildpackage -rfakeroot -b -uc -us
+
+ls -alh ../*.deb
+mkdir -p /artifacts/wallet-core/${CI_COMMIT_REF} # Variable comes from CI environment
+mv ../*.deb /artifacts/wallet-core/${CI_COMMIT_REF}/
diff --git a/contrib/ci/jobs/4-taler-harness-deb-package/version.sh b/contrib/ci/jobs/4-taler-harness-deb-package/version.sh
new file mode 100755
index 000000000..52031b23a
--- /dev/null
+++ b/contrib/ci/jobs/4-taler-harness-deb-package/version.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -ex
+
+BRANCH=$(git name-rev --name-only HEAD)
+if [ -z "${BRANCH}" ]; then
+ exit 1
+else
+ # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
+ git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
+ RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1)
+ commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+ if [ "${commits}" = "0" ]; then
+ git describe --tag HEAD | sed -r 's/^v//' || exit 1
+ else
+ echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
+ fi
+fi
diff --git a/contrib/ci/jobs/5-deploy-packages/config.ini b/contrib/ci/jobs/5-deploy-packages/config.ini
new file mode 100644
index 000000000..08c106f9c
--- /dev/null
+++ b/contrib/ci/jobs/5-deploy-packages/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = True
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = False
+CONTAINER_NAME = nixery.dev/shell/rsync
+CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/5-deploy-packages/job.sh b/contrib/ci/jobs/5-deploy-packages/job.sh
new file mode 100755
index 000000000..46ed90f70
--- /dev/null
+++ b/contrib/ci/jobs/5-deploy-packages/job.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -exuo pipefail
+
+ARTIFACT_PATH="/artifacts/wallet-core/${CI_COMMIT_REF}/*.deb"
+
+RSYNC_HOST="taler.host.internal"
+RSYNC_PORT=424242
+RSYNC_PATH="incoming_packages/bookworm-taler-ci/"
+RSYNC_DEST="rsync://${RSYNC_HOST}/${RSYNC_PATH}"
+
+
+rsync -vP \
+ --port ${RSYNC_PORT} \
+ ${ARTIFACT_PATH} ${RSYNC_DEST}