diff options
author | Devan Carpenter <git@dvn.me> | 2023-11-22 22:54:30 -0500 |
---|---|---|
committer | Devan Carpenter <git@dvn.me> | 2023-11-22 22:54:30 -0500 |
commit | 2f3120f189968c47c305ec7c66dba5b38bfb4170 (patch) | |
tree | f7cf503eb78a58e03c8713b4c3c7ec103bf18c1e /contrib/ci | |
parent | 12ab12595f5021427c4d09623f0d7bb9aac21710 (diff) | |
download | gnunet-2f3120f189968c47c305ec7c66dba5b38bfb4170.tar.gz gnunet-2f3120f189968c47c305ec7c66dba5b38bfb4170.zip |
ci: move to contrib dir
Diffstat (limited to 'contrib/ci')
-rw-r--r-- | contrib/ci/Containerfile | 43 | ||||
-rwxr-xr-x | contrib/ci/ci.sh | 30 | ||||
-rwxr-xr-x | contrib/ci/jobs/0-build/build.sh | 10 | ||||
-rwxr-xr-x | contrib/ci/jobs/0-build/job.sh | 6 | ||||
-rwxr-xr-x | contrib/ci/jobs/2-deb-package/job.sh | 22 | ||||
-rwxr-xr-x | contrib/ci/jobs/2-deb-package/version.sh | 12 | ||||
-rw-r--r-- | contrib/ci/jobs/3-deploy-package/config.ini | 5 | ||||
-rwxr-xr-x | contrib/ci/jobs/3-deploy-package/job.sh | 14 |
8 files changed, 142 insertions, 0 deletions
diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile new file mode 100644 index 000000000..e0778e7b7 --- /dev/null +++ b/contrib/ci/Containerfile | |||
@@ -0,0 +1,43 @@ | |||
1 | FROM docker.io/library/debian:bookworm | ||
2 | |||
3 | ENV DEBIAN_FRONTEND=noninteractive | ||
4 | |||
5 | RUN apt-get update -yqq && \ | ||
6 | apt-get upgrade -yqq && \ | ||
7 | apt-get install -yqq \ | ||
8 | git \ | ||
9 | autoconf \ | ||
10 | libextractor-dev \ | ||
11 | libjansson-dev \ | ||
12 | libgcrypt-dev \ | ||
13 | libqrencode-dev \ | ||
14 | libpq-dev \ | ||
15 | libmicrohttpd-dev \ | ||
16 | pkg-config \ | ||
17 | libtool \ | ||
18 | recutils \ | ||
19 | make \ | ||
20 | python3-sphinx \ | ||
21 | python3-sphinx-book-theme \ | ||
22 | texinfo \ | ||
23 | autopoint \ | ||
24 | curl \ | ||
25 | libcurl4-openssl-dev \ | ||
26 | libsodium-dev \ | ||
27 | libidn11-dev \ | ||
28 | zlib1g-dev \ | ||
29 | libunistring-dev \ | ||
30 | iptables | ||
31 | |||
32 | # Debian packaging tools | ||
33 | RUN apt-get install -yqq \ | ||
34 | po-debconf \ | ||
35 | build-essential \ | ||
36 | debhelper-compat \ | ||
37 | devscripts \ | ||
38 | git-buildpackage \ | ||
39 | && rm -rf /var/lib/apt/lists/* | ||
40 | |||
41 | WORKDIR /workdir | ||
42 | |||
43 | CMD ["/bin/bash"] | ||
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh new file mode 100755 index 000000000..7dd3a957a --- /dev/null +++ b/contrib/ci/ci.sh | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/bin/bash | ||
2 | set -evuo pipefail | ||
3 | |||
4 | # Use podman if available, otherwise use docker. | ||
5 | # Fails if neither is found in PATH | ||
6 | OCI_RUNTIME=$(which podman || which docker) | ||
7 | REPO_NAME=$(basename "${PWD}") | ||
8 | JOB_NAME="${1}" | ||
9 | JOB_CONTAINER=$((grep CONTAINER_NAME ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${REPO_NAME}") | ||
10 | |||
11 | echo "${JOB_CONTAINER}" | ||
12 | |||
13 | if [ "${JOB_CONTAINER}" = "${REPO_NAME}" ] ; then | ||
14 | "${OCI_RUNTIME}" build \ | ||
15 | -t "${JOB_CONTAINER}" \ | ||
16 | -f ci/Containerfile . | ||
17 | fi | ||
18 | |||
19 | "${OCI_RUNTIME}" run \ | ||
20 | --rm \ | ||
21 | -ti \ | ||
22 | --env CI_COMMIT_REF="$(git rev-parse HEAD)" \ | ||
23 | --volume "${PWD}":/workdir \ | ||
24 | --workdir /workdir \ | ||
25 | "${JOB_CONTAINER}" \ | ||
26 | ci/jobs/"${JOB_NAME}"/job.sh | ||
27 | |||
28 | top_dir=$(dirname "${BASH_SOURCE[0]}") | ||
29 | |||
30 | #"${top_dir}"/build.sh | ||
diff --git a/contrib/ci/jobs/0-build/build.sh b/contrib/ci/jobs/0-build/build.sh new file mode 100755 index 000000000..a5a89ca82 --- /dev/null +++ b/contrib/ci/jobs/0-build/build.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | set -exuo pipefail | ||
3 | |||
4 | ./bootstrap | ||
5 | ./configure CFLAGS="-ggdb -O0" \ | ||
6 | --enable-logging=verbose \ | ||
7 | --disable-doc | ||
8 | |||
9 | make -j $(nproc) | ||
10 | make install | ||
diff --git a/contrib/ci/jobs/0-build/job.sh b/contrib/ci/jobs/0-build/job.sh new file mode 100755 index 000000000..8d79902c5 --- /dev/null +++ b/contrib/ci/jobs/0-build/job.sh | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/bin/bash | ||
2 | set -exuo pipefail | ||
3 | |||
4 | job_dir=$(dirname "${BASH_SOURCE[0]}") | ||
5 | |||
6 | "${job_dir}"/build.sh | ||
diff --git a/contrib/ci/jobs/2-deb-package/job.sh b/contrib/ci/jobs/2-deb-package/job.sh new file mode 100755 index 000000000..fc1f114f4 --- /dev/null +++ b/contrib/ci/jobs/2-deb-package/job.sh | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/bash | ||
2 | set -exuo pipefail | ||
3 | # This file is in the public domain. | ||
4 | # Helper script to build the latest DEB packages in the container. | ||
5 | |||
6 | |||
7 | unset LD_LIBRARY_PATH | ||
8 | |||
9 | # Install build-time dependencies. | ||
10 | # Update apt cache first | ||
11 | apt-get update | ||
12 | mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control | ||
13 | |||
14 | export VERSION="$(./ci/jobs/2-deb-package/version.sh)" | ||
15 | echo "Building gnunet packages version ${VERSION}" | ||
16 | EMAIL=none gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" | ||
17 | ./bootstrap | ||
18 | dpkg-buildpackage -rfakeroot -b -uc -us | ||
19 | |||
20 | ls -alh ../*.deb | ||
21 | mkdir -p /artifacts/gnunet/${CI_COMMIT_REF} # Variable comes from CI environment | ||
22 | mv ../*.deb /artifacts/gnunet/${CI_COMMIT_REF}/ | ||
diff --git a/contrib/ci/jobs/2-deb-package/version.sh b/contrib/ci/jobs/2-deb-package/version.sh new file mode 100755 index 000000000..74d0099a2 --- /dev/null +++ b/contrib/ci/jobs/2-deb-package/version.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/sh | ||
2 | set -ex | ||
3 | |||
4 | git fetch origin $(git rev-parse --abbrev-ref HEAD) --depth=1000 --tags | ||
5 | RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 HEAD) | ||
6 | |||
7 | commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" | ||
8 | if [ "${commits}" = "0" ]; then | ||
9 | git describe --tag HEAD | ||
10 | else | ||
11 | echo $(echo ${RECENT_VERSION_TAG} | cut -d'v' -f2)-${commits}-$(git rev-parse --short=8 HEAD) | ||
12 | fi | ||
diff --git a/contrib/ci/jobs/3-deploy-package/config.ini b/contrib/ci/jobs/3-deploy-package/config.ini new file mode 100644 index 000000000..8d6409a6e --- /dev/null +++ b/contrib/ci/jobs/3-deploy-package/config.ini | |||
@@ -0,0 +1,5 @@ | |||
1 | [build] | ||
2 | HALT_ON_FAILURE = True | ||
3 | WARN_ON_FAILURE = True | ||
4 | CONTAINER_BUILD = False | ||
5 | CONTAINER_NAME = nixery.dev/shell/rsync | ||
diff --git a/contrib/ci/jobs/3-deploy-package/job.sh b/contrib/ci/jobs/3-deploy-package/job.sh new file mode 100755 index 000000000..d53588a0f --- /dev/null +++ b/contrib/ci/jobs/3-deploy-package/job.sh | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/bin/bash | ||
2 | set -exuo pipefail | ||
3 | |||
4 | ARTIFACT_PATH="/artifacts/gnunet/${CI_COMMIT_REF}/*.deb" | ||
5 | |||
6 | RSYNC_HOST="taler.host.internal" | ||
7 | RSYNC_PORT=424242 | ||
8 | RSYNC_PATH="incoming_packages/bookworm-taler-ci/" | ||
9 | RSYNC_DEST="rsync://${RSYNC_HOST}/${RSYNC_PATH}" | ||
10 | |||
11 | |||
12 | rsync -vP \ | ||
13 | --port ${RSYNC_PORT} \ | ||
14 | ${ARTIFACT_PATH} ${RSYNC_DEST} | ||