Skip to content

Commit

Permalink
add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonEhrig committed Jun 27, 2024
1 parent cc4895d commit 59d0f2a
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
stages:
- unit-test
- generate_integration_test
- run_integration_test
- verify-unit-test-deps

.untit_test_template:
stage: unit-test
Expand Down Expand Up @@ -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

0 comments on commit 59d0f2a

Please sign in to comment.