gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: first stab at CI


From: gnunet
Subject: [libeufin] branch master updated: first stab at CI
Date: Sun, 18 Feb 2024 22:09:45 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 7083a8f7 first stab at CI
7083a8f7 is described below

commit 7083a8f73625817bf98b93981fed0f1dd6b44eca
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 18 22:09:38 2024 +0100

    first stab at CI
---
 contrib/ci/Containerfile                    | 28 ++++++++++++++++++++++++
 contrib/ci/ci.sh                            | 34 +++++++++++++++++++++++++++++
 contrib/ci/jobs/0-codespell/config.ini      |  6 +++++
 contrib/ci/jobs/0-codespell/dictionary.txt  | 15 +++++++++++++
 contrib/ci/jobs/0-codespell/job.sh          | 21 ++++++++++++++++++
 contrib/ci/jobs/1-build/build.sh            |  6 +++++
 contrib/ci/jobs/1-build/job.sh              |  9 ++++++++
 contrib/ci/jobs/2-test/config.ini           |  6 +++++
 contrib/ci/jobs/2-test/job.sh               |  6 +++++
 contrib/ci/jobs/2-test/test.sh              | 24 ++++++++++++++++++++
 contrib/ci/jobs/3-docs/config.ini           |  6 +++++
 contrib/ci/jobs/3-docs/docs.sh              |  7 ++++++
 contrib/ci/jobs/3-docs/job.sh               |  6 +++++
 contrib/ci/jobs/4-deb-package/job.sh        | 22 +++++++++++++++++++
 contrib/ci/jobs/4-deb-package/version.sh    | 17 +++++++++++++++
 contrib/ci/jobs/5-deploy-package/config.ini |  6 +++++
 contrib/ci/jobs/5-deploy-package/job.sh     | 14 ++++++++++++
 contrib/wallet-core                         |  2 +-
 18 files changed, 234 insertions(+), 1 deletion(-)

diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile
new file mode 100644
index 00000000..bf3db541
--- /dev/null
+++ b/contrib/ci/Containerfile
@@ -0,0 +1,28 @@
+FROM docker.io/library/debian:bookworm
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update -yqq && \
+    apt-get install -yqq \
+                  unzip \
+                  openjdk-21-jdk \
+                  openjdk-21-jdk-headless \
+                   make \
+                   git \
+                   python3 \
+                  curl \
+                   wget \
+                   po-debconf \
+                   build-essential \
+                   debhelper-compat \
+                   devscripts \
+                  git-buildpackage \
+                   postgresql \
+                   sudo \
+                   jq
+
+# RUN pip3 install --break-system-packages requests click poetry uwsgi htmlark
+
+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 00000000..0719015b
--- /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 00000000..bd7d7386
--- /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 00000000..5ad828fb
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/dictionary.txt
@@ -0,0 +1,15 @@
+# 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'.
+#
+ifset
+bu
+fIDN
+ECT
+complet
+ges
+UE
+Te
diff --git a/contrib/ci/jobs/0-codespell/job.sh 
b/contrib/ci/jobs/0-codespell/job.sh
new file mode 100755
index 00000000..cff84c24
--- /dev/null
+++ b/contrib/ci/jobs/0-codespell/job.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -exuo pipefail
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+skip=$(cat <<EOF
+ABOUT-NLS
+configure
+config.guess
+configure~
+*/debian/upstream/*
+*/debian/.debhelper/*
+*/doc/prebuilt/*
+*/.git/*
+*/contrib/ci/*
+EOF
+);
+
+echo Current directory: `pwd`
+
+codespell -I "${job_dir}"/dictionary.txt -S ${skip//$'\n'/,}
diff --git a/contrib/ci/jobs/1-build/build.sh b/contrib/ci/jobs/1-build/build.sh
new file mode 100755
index 00000000..6adbc8a9
--- /dev/null
+++ b/contrib/ci/jobs/1-build/build.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+./bootstrap
+./configure --prefix=/usr
+make
diff --git a/contrib/ci/jobs/1-build/job.sh b/contrib/ci/jobs/1-build/job.sh
new file mode 100755
index 00000000..c1fc4e32
--- /dev/null
+++ b/contrib/ci/jobs/1-build/job.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -exuo pipefail
+
+apt-get update -yq
+apt-get upgrade -yq
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+"${job_dir}"/build.sh
diff --git a/contrib/ci/jobs/2-test/config.ini 
b/contrib/ci/jobs/2-test/config.ini
new file mode 100644
index 00000000..759fc9ff
--- /dev/null
+++ b/contrib/ci/jobs/2-test/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = True
+CONTAINER_NAME = localhost/libeufin
+CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/2-test/job.sh b/contrib/ci/jobs/2-test/job.sh
new file mode 100755
index 00000000..bfb24e33
--- /dev/null
+++ b/contrib/ci/jobs/2-test/job.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -exuo pipefail
+
+job_dir=$(dirname "${BASH_SOURCE[0]}")
+
+"${job_dir}"/test.sh
diff --git a/contrib/ci/jobs/2-test/test.sh b/contrib/ci/jobs/2-test/test.sh
new file mode 100755
index 00000000..33aea201
--- /dev/null
+++ b/contrib/ci/jobs/2-test/test.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -evu
+
+apt-get update
+apt-get upgrade -yqq
+
+./bootstrap
+./configure --prefix=/usr
+make -j install
+
+sudo -u postgres /usr/lib/postgresql/15/bin/postgres -D 
/etc/postgresql/15/main -h localhost -p 5432 &
+sleep 10
+sudo -u postgres createuser -p 5432 root
+#sudo -u postgres createdb -p 5432 -O root synccheck
+
+check_command()
+{
+       PGPORT=5432 make check &> test-suite.log
+}
+
+if ! check_command ; then
+    cat test-suite.log
+    exit 1
+fi
diff --git a/contrib/ci/jobs/3-docs/config.ini 
b/contrib/ci/jobs/3-docs/config.ini
new file mode 100644
index 00000000..759fc9ff
--- /dev/null
+++ b/contrib/ci/jobs/3-docs/config.ini
@@ -0,0 +1,6 @@
+[build]
+HALT_ON_FAILURE = False
+WARN_ON_FAILURE = True
+CONTAINER_BUILD = True
+CONTAINER_NAME = localhost/libeufin
+CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/3-docs/docs.sh b/contrib/ci/jobs/3-docs/docs.sh
new file mode 100755
index 00000000..8a56ae7b
--- /dev/null
+++ b/contrib/ci/jobs/3-docs/docs.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -exuo pipefail
+
+./bootstrap
+./configure --prefix=/usr
+
+make doc
diff --git a/contrib/ci/jobs/3-docs/job.sh b/contrib/ci/jobs/3-docs/job.sh
new file mode 100755
index 00000000..a72bca4b
--- /dev/null
+++ b/contrib/ci/jobs/3-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/4-deb-package/job.sh 
b/contrib/ci/jobs/4-deb-package/job.sh
new file mode 100755
index 00000000..e60f2f1b
--- /dev/null
+++ b/contrib/ci/jobs/4-deb-package/job.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -exuo pipefail
+# This file is in the public domain.
+# Helper script to build the latest DEB packages in the container.
+
+# 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-deb-package/version.sh)"
+echo "Building package version ${VERSION}"
+EMAIL=none gbp dch --ignore-branch --debian-tag="%(version)s" --git-author 
--new-version="${VERSION}"
+./bootstrap
+./configure --prefix=/usr
+make install
+dpkg-buildpackage -rfakeroot -b -uc -us
+
+ls -alh ../*.deb
+mkdir -p /artifacts/libeufin/${CI_COMMIT_REF} # Variable comes from CI 
environment
+mv ../*.deb /artifacts/libeufin/${CI_COMMIT_REF}/
diff --git a/contrib/ci/jobs/4-deb-package/version.sh 
b/contrib/ci/jobs/4-deb-package/version.sh
new file mode 100755
index 00000000..d2647785
--- /dev/null
+++ b/contrib/ci/jobs/4-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*.*.*' --always 
--abbrev=0 HEAD || exit 1)
+       commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+       if [ "${commits}" = "0" ]; then
+               git describe --tag HEAD || 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-package/config.ini 
b/contrib/ci/jobs/5-deploy-package/config.ini
new file mode 100644
index 00000000..08c106f9
--- /dev/null
+++ b/contrib/ci/jobs/5-deploy-package/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-package/job.sh 
b/contrib/ci/jobs/5-deploy-package/job.sh
new file mode 100755
index 00000000..6c30696f
--- /dev/null
+++ b/contrib/ci/jobs/5-deploy-package/job.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -exuo pipefail
+
+ARTIFACT_PATH="/artifacts/libeufin/${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}
diff --git a/contrib/wallet-core b/contrib/wallet-core
index a431332f..a675c940 160000
--- a/contrib/wallet-core
+++ b/contrib/wallet-core
@@ -1 +1 @@
-Subproject commit a431332f59a8557edba64b24b8c6a6fcc140e2bd
+Subproject commit a675c94085cfa90052c9ebacd2cebccfab2c4f18

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]