-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
162 lines (150 loc) · 3.79 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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
155
156
157
158
159
160
161
162
image: makeappdev/cpp-dev:24.04
stages:
- build
- test
- deploy
.no_schedule:
except:
- schedules
.python_setup: &python_setup
variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
PRE_COMMIT_HOME: "${CI_PROJECT_DIR}/.cache/pre-commit"
before_script:
- python -V
- pipx install uv
- uv venv
- source .venv/bin/activate
- uv pip install --upgrade -r requirements.txt
cache:
paths:
- .cache/pip
- .cache/pre-commit
- .venv/
.cpp_build:
extends: .no_schedule
stage: build
script:
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- make -j8
- make test
- make coverage
pre-commit_checks:
extends:
- .no_schedule
- .python_setup
stage: build
script:
- pre-commit run --from-ref origin/master --to-ref HEAD
cpp_build_test_gcc:
extends: .cpp_build
cpp_build_test_clang:
extends: .cpp_build
before_script:
- use_clang.sh
artifacts:
expire_in: 1 week
paths:
- build/ccov/all-merged/
slides:
extends: .no_schedule
variables:
DOCKER_TLS_CERTDIR: ""
stage: build
image: docker:dind
services:
- docker:dind
before_script:
- apk add --no-cache --update docker make curl && rm -rf /var/cache/apk/*
- mkdir -p ~/.docker/cli-plugins/
- curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
- chmod +x ~/.docker/cli-plugins/docker-compose
- docker compose --version
script:
- mkdir -p build && chmod -R 0777 build
- make slides
artifacts:
expire_in: 1 week
paths:
- slides/build
docs:
extends: .no_schedule
stage: build
image: asciidoctor/docker-asciidoctor:latest
script:
- cd docs
- make html
- make pdf
artifacts:
expire_in: 1 week
paths:
- docs/output
python_tests:
extends:
- .no_schedule
- .python_setup
stage: build
script:
- make test
- make coverage_reports
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
expire_in: 1 week
paths:
- tools/htmlcov
reports:
coverage_report:
coverage_format: cobertura
path: tools/coverage.xml
pages:
extends: .no_schedule
stage: deploy
dependencies:
- cpp_build_test_clang
- python_tests
- slides
- docs
before_script:
- apt-get update
- apt-get install -y zip
script:
- mkdir -p public
- mv docs/output/* public
- mv slides/build/* public
- mkdir -p public/export
- make package
- mv export/*.zip public/export
- make solution_package
- mv export/*.zip public/export
- mkdir -p public/coverage
- mv build/ccov/all-merged public/coverage/cpp
- mv tools/htmlcov/ public/coverage/python
artifacts:
expire_in: 1 week
paths:
- public
only:
- master
student_code_evaluation:
<<: *python_setup # Use anchor over extends to avoid overriding the variables
only:
- schedules
variables:
WORKSPACE: workspace
SEL_CI_MODE: $CI
script:
- mkdir -p $WORKSPACE
- echo "$REPO_INFO_FILE" # has to be set in the schedule definition
- echo "$HOMEWORK_NUMBER" # has to be set in the schedule definition
- echo "$LAST_HOMEWORK_DATE" # has to be set in the schedule definition
- python3 tools/gitlab_projects.py evaluate_code $REPO_INFO_FILE --gitlab-token $GITLAB_TOKEN --homework-number $HOMEWORK_NUMBER --date-last-homework $LAST_HOMEWORK_DATE --workspace $WORKSPACE
# GITLAB_TOKEN is a protected & masked variable set in this project and contains a gitlab API token with "read_api" scope
artifacts:
paths:
- $WORKSPACE/**/*-report.json
- $WORKSPACE/**/*-report.md
- $WORKSPACE/**/*-diff.csv
- $WORKSPACE/**/*.patch
- $WORKSPACE/**/*.html