chore(gitlab-ci): first stub of major ci update

This commit is contained in:
Sarah Vaupel 2024-08-19 01:00:50 +02:00
parent ce3dcfdbd3
commit 8140ebdc6d

View File

@ -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