From 8140ebdc6dc3a8a3bc6e583223cb285366c1f757 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Mon, 19 Aug 2024 01:00:50 +0200 Subject: [PATCH] chore(gitlab-ci): first stub of major ci update --- .gitlab-ci.yml | 151 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 51 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b647f51f..bf2df9fdc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,13 +24,14 @@ variables: default: image: - name: registry.uniworx.de/fradrive/fradrive/fradrive-env:latest # Debian 12.5 Bookworm - entrypoint: [""] - docker: - platform: x86_64 - user: ${ENV_USER} - before_script: - - chown -R ${ENV_USER} . # Change project directory ownership to (non-root) user inside docker container + name: dind + # name: registry.uniworx.de/fradrive/fradrive/fradrive-env:latest # Debian 12.5 Bookworm + # entrypoint: [""] + # docker: + # platform: x86_64 + # user: ${ENV_USER} + # before_script: + # - chown -R ${ENV_USER} . # Change project directory ownership to (non-root) user inside docker container artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" @@ -38,62 +39,110 @@ default: interruptible: true -stages: - - setup - - build - - lint - - test - - container - - prepare release - - release +# TODO: Rethink and reintroduce stages +# stages: + # - setup + # - build + # - lint + # - test + # - container + # - prepare release + # - release - -frontend dependencies: - stage: setup - cache: - - &npm-cache - key: default-npm - paths: &npm-paths - - node_modules/ - - .npm/ - - .npmrc +frontend image: script: - - make node_modules + # TODO: define make target for this + - make -- --docker-build-frontend-build FRADRIVE_DOCKERFILE=frontend + - docker image save frontend | gzip > docker/frontend/image.tar.gz artifacts: - paths: *npm-paths + paths: + - docker/frontend/image.tar.gz -well-known: - stage: setup - script: - - make well-known +frontend build: needs: - - job: frontend dependencies + - job: frontend image artifacts: true + script: + - zcat docker/frontend/image.tar.gz | docker image load + - docker run --rm -it -v ${CI_PROJECT_DIR}:/fradrive --env FRADRIVE_MAKE_TARGET=frontend-build frontend # TODO: define new make target or make current target compatible + artifacts: + paths: + - /fradrive/node_modules + - /fradrive/well-known cache: - &frontend-cache key: default-frontend paths: - - .well-known-cache - artifacts: - paths: - - well-known/ - - .well-known-cache/ + - /fradrive/.npm/ + - /fradrive/.well-known-cache/ -# TODO: cache is always uploaded even if up-to-date; prevent re-upload when up-to-date -backend dependencies: - stage: setup - cache: - - &stack-cache - key: default-stack - paths: - - .stack/ - - .stack-work/ +frontend lint: + needs: + - job: frontend image + artifacts: true + +frontend test: + needs: + - job: frontend image + artifacts: true + - job: frontend build + artifacts: true + +push image(s): + needs: + - job: frontend image + artifacts: true script: - - make backend-dependencies-prod - artifacts: - paths: - - .stack/ - - .stack-work/ + - docker load ... + - docker tag ... + - docker push ... + +# frontend dependencies: +# stage: setup +# cache: +# - &npm-cache +# key: default-npm +# paths: &npm-paths +# - node_modules/ +# - .npm/ +# - .npmrc +# script: +# - make node_modules +# artifacts: +# paths: *npm-paths + +# well-known: +# stage: setup +# script: +# - make well-known +# needs: +# - job: frontend dependencies +# artifacts: true +# cache: +# - &frontend-cache +# key: default-frontend +# paths: +# - .well-known-cache +# artifacts: +# paths: +# - well-known/ +# - .well-known-cache/ + +# # TODO: cache is always uploaded even if up-to-date; prevent re-upload when up-to-date +# backend dependencies: +# stage: setup +# cache: +# - &stack-cache +# key: default-stack +# paths: +# - .stack/ +# - .stack-work/ +# script: +# - make backend-dependencies-prod +# artifacts: +# paths: +# - .stack/ +# - .stack-work/ frontend build: stage: build