From e15e5165fb47a8e0d2fcb69a2d82a498e6343d39 Mon Sep 17 00:00:00 2001 From: Simeon Ehrig Date: Thu, 27 Jun 2024 11:38:19 +0200 Subject: [PATCH] add integration tests --- .gitlab-ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d24301b..3f8e5d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,8 @@ stages: - unit-test + - generate_integration_test + - run_integration_test + - verify-unit-test-deps .untit_test_template: stage: unit-test @@ -50,3 +53,60 @@ unit_tests_nightly: allow_failure: true tags: - cpuonly + +generate_integration_tests: + image: julia:1.10 + stage: generate_integration_test + script: + # extract package name + - export CI_DEPENDENCY_NAME=$(cat $CI_PROJECT_DIR/Project.toml | grep name | awk '{ print $3 }' | tr -d '"') + - echo "CI_DEPENDENCY_NAME -> $CI_DEPENDENCY_NAME" + - apt update && apt install -y git + - git clone --depth 1 -b dev https://github.com/QEDjl-project/QED.jl.git /QEDjl + - cd /QEDjl/.ci/integTestGen/ + # use local registry of the QED project + - julia --project=. -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/QEDjl-project/registry.git"));' + # needs to add General registry again, if local registry was added + - julia --project=. -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JuliaRegistries/General"));' + - julia --project=. -e 'import Pkg; Pkg.instantiate()' + # paths of artifacts are relative to CI_PROJECT_DIR + - > + if [[ $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_REF_NAME == "dev" ]]; then + # set name of the commit message from CI_COMMIT_MESSAGE to NO_MESSAGE, that the script does not read accidentally custom packages from the commit message of a merge commit + julia --project=. src/integTestGen.jl NO_MESSAGE > $CI_PROJECT_DIR/integrationjobs.yaml + else + julia --project=. src/integTestGen.jl > $CI_PROJECT_DIR/integrationjobs.yaml + fi + - cat $CI_PROJECT_DIR/integrationjobs.yaml + artifacts: + paths: + - integrationjobs.yaml + expire_in: 1 week + interruptible: true + tags: + - cpuonly + +run_integration_tests: + stage: run_integration_test + trigger: + include: + - artifact: integrationjobs.yaml + job: generate_integration_tests + strategy: depend + +verify-unit-test-deps_julia1.10: + image: julia:1.10 + stage: verify-unit-test-deps + script: + - apt update && apt install -y git + - git clone --depth 1 -b dev https://github.com/QEDjl-project/QED.jl.git /QEDjl + - > + if [[ $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_REF_NAME == "dev" ]]; then + # does not check for custom package URLs on the main and dev branch + echo "no custom package URL check necessary" + else + julia /QEDjl/.ci/verify_env.jl + fi + interruptible: true + tags: + - cpuonly