Newer
Older
Schrödter, Tobias
committed
- build_environment
- build_installer
- deploy
Schrödter, Tobias
committed
###############################################################################
# Linux CI
###############################################################################
# Build environment for building and testing the program. Uses the Dockerfile
# from the repository
build_container:
stage: build_environment
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/container/arch/Dockerfile --destination $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}_linux
rules:
- changes:
Schrödter, Tobias
committed
# Build petrack and petrack unit_tests
build_linux:
image: $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}_linux
stage: build
script:
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_UNIT_TESTS=ON
- cmake --build . -- -j4
artifacts:
paths:
- "./build/"
expire_in: 2 hrs
# Execute unit tests
unit_test_linux:
image: $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}_linux
stage: test
script:
- cd build/tests/unit_test
- ./petrack_tests -platform offscreen -r junit -o unit_test_report.xml
artifacts:
when: always
paths:
- build/tests/unit_test/unit_test_report.xml
reports:
junit: "build/tests/unit_test/unit_test_report.xml"
#regression_test_linux:
# image: $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}_linux
# stage: test
# script:
# - cd tests/regression_test/tests
# - python -m pytest --path=../../../build/petrack --junitxml=pytest_report.xml >> "RegressionTestLog.txt"
# artifacts:
# when: on_failure
# paths:
# - "tests/regression_test/tests/RegressionTestLog.txt"
# reports:
# junit: "tests/regression_test/tests/pytest_report.xml"
Schrödter, Tobias
committed
###############################################################################
# Windows CI
###############################################################################
# Build petrack and petrack unit_tests
Schrödter, Tobias
committed
- $env:Path += ";C:\Program Files\CMake\bin"
- cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_UNIT_TESTS=ON -DUSE_3RD_PARTY=ON ..
- cmake --build . -- -j6
artifacts:
paths:
- "./build/petrack.exe"
- "./build/tests/unit_test/petrack_tests.exe"
Schrödter, Tobias
committed
# Execute unit tests
unit_test_windows:
Schrödter, Tobias
committed
- cd build/tests/unit_test
- ./petrack_tests.exe -r junit -o unit_test_report.xml
Schrödter, Tobias
committed
when: always
Schrödter, Tobias
committed
- build/tests/unit_test/unit_test_report.xml
Schrödter, Tobias
committed
junit: "build/tests/unit_test/unit_test_report.xml"
Schrödter, Tobias
committed
# Ggf. muss man nicht in den Ordner der Testskripte verzweigen, da PyTest auch rekusrsiv in Unterorndern nach tests sucht
regression_test_windows:
stage: test
tags:
- windows
script:
Schrödter, Tobias
committed
- cd tests/regression_test/tests
- python -m pytest --junitxml=pytest_report.xml | Tee-Object -FilePath "RegressionTestLog.txt"
Schrödter, Tobias
committed
when: on_failure
Schrödter, Tobias
committed
- "tests/regression_test/tests/RegressionTestLog.txt"
Schrödter, Tobias
committed
junit: "tests/regression_test/tests/pytest_report.xml"
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
build_windows_installer:
stage: build_installer
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
tags:
- windows
script:
- mkdir -Force build
- $env:Path += ";C:\Program Files\CMake\bin"
- cd build
- rm *
- cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_UNIT_TESTS=ON -DUSE_3RD_PARTY=ON ..
- cpack -C Release
artifacts:
paths:
- "build/petrack-installer-*"
expire_in: 2hrs
make_release:
image: alpine
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs: ["build_windows_installer"]
script:
- apk --no-cache add curl
- cd build
- winInst=$(echo petrack-installer-*)
- curl -k -T $winInst -u "${SCIEBO_TOKEN}:" https://fz-juelich.sciebo.de/public.php/webdav/$winInst