diff options
-rw-r--r-- | .gitlab-ci.yml | 82 | ||||
-rw-r--r-- | ChangeLog.md | 4 | ||||
-rw-r--r-- | TODO.md | 1 |
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 @@ -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 |