aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-06-09 14:24:41 +0100
committerSilvio Rhatto <rhatto@riseup.net>2024-06-09 14:24:41 +0100
commitede357d0da6abacea6ec14483479451b219c6c73 (patch)
tree4dc8a705e8d69c64031e4e740adbd4174c1478df
parentf002bee607d0dd09f15bd6c825903996876daafd (diff)
downloadbookup-ede357d0da6abacea6ec14483479451b219c6c73.tar.gz
bookup-ede357d0da6abacea6ec14483479451b219c6c73.tar.bz2
Feat: GitLab CI
-rw-r--r--.gitlab-ci.yml82
-rw-r--r--ChangeLog.md4
-rw-r--r--TODO.md1
3 files changed, 86 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..766adfc
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,82 @@
+---
+# CI/CD stages
+stages:
+ # Custom container image procedures
+ #- build
+
+ # Compilation procedure
+ - compile
+
+# Common variables
+#variables:
+# TAGGED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
+# LATEST_IMAGE: $CI_REGISTRY_IMAGE:latest
+
+# Common rules
+.default_rules:
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "schedule"
+ when: always
+ allow_failure: false
+ - if: $CI_COMMIT_TAG
+ when: always
+ allow_failure: false
+ - when: manual
+ allow_failure: true
+
+# Custom container image
+# This might be faster and save resources between CI/CD jobs.
+#build:
+# image: docker:latest
+#
+# stage: build
+#
+# services:
+# - docker:dind
+#
+# script:
+# # Thanks https://stackoverflow.com/questions/55258711/gitlab-ci-how-to-avoid-rebuilding-of-images-on-each-commit
+# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+# - docker image pull $LATEST_IMAGE || true
+# - docker build --pull -t $TAGGED_IMAGE --cache-from $LATEST_IMAGE .
+# - docker tag $TAGGED_IMAGE $LATEST_IMAGE
+# - docker push $LATEST_IMAGE
+# - docker push $TAGGED_IMAGE
+#
+# rules:
+# - !reference [.default_rules, rules]
+
+compile:
+ # Use $LATEST_IMAGE when relying on the custom container image
+ #image: $LATEST_IMAGE
+ image: debian:bookworm
+
+ stage: compile
+
+ script:
+ # Initialize all submodules
+ # Need a special config to be able to clone the `biblio` repository
+ # See https://stackoverflow.com/questions/25689231/getting-gitlab-ci-to-clone-private-repositories#38570269
+ - apt-get update
+ - apt-get install -y git
+ - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@0xacab.org/".insteadOf "https://0xacab.org/"
+ - git submodule update --init --recursive
+
+ # Install rsync to copy artifacts
+ - apt-get install -y rsync
+
+ # Comment this stage if using the custom container image
+ - bin/provision
+
+ # Compile
+ - make
+
+ # Create the "public" artifact
+ - rsync -a ./build public/
+
+ artifacts:
+ paths:
+ - public
+
+ rules:
+ - !reference [.default_rules, rules]
diff --git a/ChangeLog.md b/ChangeLog.md
index 3f2c95a..d42f41e 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
# ChangeLog
+## v0.0.7 - unreleased
+
+* [x] GitLab CI.
+
## v0.0.6 - 2024-06-09
### Features
diff --git a/TODO.md b/TODO.md
index d3aa187..da82d17 100644
--- a/TODO.md
+++ b/TODO.md
@@ -34,7 +34,6 @@
## Bonus
-* [ ] GitLab CI.
* [ ] Localization support?
* It makes sense to localize common strings in the book structure.
* But maybe it does not make much sense to localize strings in PO files for