blob: 6b96e4ea8b36a07f8f3ad7185b0c5edbfae9248a (
plain)
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
image: alpine:3.21.3
stages:
- build
- test
- deploy
- release
.on_mr_only:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
.connect_to_intra_git:
image:
name: alpine/git:2.47.1
entrypoint: [""]
environment:
name: forge-intra
url: https://intra.forge.epita.fr/epita-ing-assistants-yaka/tiger-2027/root/tiger-2027/
before_script:
##
## Check that all parameters are properly defined
##
- test -n "$GIT_INTRA_REPO_URL"
- test -n "$GIT_INTRA_GLOBAL_URL"
- test -n "$GIT_DEPLOY_BRANCH"
- test -n "$GIT_RUNNER_NAME"
- test -n "$GIT_RUNNER_EMAIL"
##
## Check that ssh-agent is active. Install it and start it if it isn't yet
##
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
##
## Add the SSH key to the known keys
##
- chmod 400 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
##
## Properly setup .ssh folder if it hasn't been properly done so already
##
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
##
## Add the host (Git repo server) to known hosts
##
- ssh-keyscan -v -H $GIT_INTRA_GLOBAL_URL >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
##
## Test connection. Stop job on failure
##
- ssh -T git@"$GIT_INTRA_GLOBAL_URL"
##
## Set Git credentials
##
- git config --global user.email "$RUNNER_GIT_EMAIL"
- git config --global user.name "$RUNNER_GIT_NAME"
# clang-format-job:
# extends: .on_mr_only
# stage: build
# allow_failure: true
# before_script:
# - apk update && apk add --no-cache clang-extra-tools
# - clang-format --version
# script:
# - find src lib -type f '(' -name '*.c?' -o -name '*.h*' ')' | xargs clang-format --Werror --dry-run
# clang-tidy-job:
# extends: .on_mr_only
# stage: build
# allow_failure: true
# before_script:
# - apk update && apk add --no-cache clang-extra-tools
# - clang-tidy --version
# script:
# # TODO: improve command (this one works but is slow)
# - find src -type f -a -name "*.cc" -exec clang-tidy {} --extra-arg=-std=c++20 -- -Isrc -Ilib \;
compilation-job:
extends: .on_mr_only
stage: build
image: registry.cri.epita.fr/martial.simon/tiger-compiler/buildenv-slim:1.1.0
before_script:
- gcc --version
- make --version
- autoreconf --version
script:
- ./bootstrap
- ./configure
- make -j
artifacts:
paths:
- src/tc
expire_in: 7 days
testing-job:
extends: .on_mr_only
stage: test
image: registry.cri.epita.fr/martial.simon/tiger-compiler/buildenv-slim:1.1.0-pytest
dependencies:
- compilation-job
before_script:
- pytest --version
script:
- cd tests/python
- CI=1 pytest
push-master-state-to-intra-job:
extends: .connect_to_intra_git
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "push"
when: always
script:
##
## Check connection to Git repo before trying to push into it
##
- git ls-remote --exit-code -h "$GIT_INTRA_REPO_URL" || { [ $? -ne 2 ] && return 1; }
##
## Get intra repo reference
##
- git remote | grep 'intra' || git remote add intra "$GIT_INTRA_REPO_URL"
- git remote update
##
## Debug dumping
##
- git log --all --oneline --graph --decorate
##
## Push
##
- git push intra HEAD:"$GIT_DEPLOY_BRANCH"
push-tag-to-intra-job:
extends: .connect_to_intra_git
stage: deploy
rules:
- if: >
$CI_COMMIT_TAG != null
&& ($CI_COMMIT_TAG =~ "/^bonus-dementor-tc\w+.*$/"
|| $CI_COMMIT_TAG =~ "/^dementor-tc\w+.*$/"
|| $CI_COMMIT_TAG =~ "/^tc\w+.*$/")
when: always
script:
##
## Check connection to Git repo before trying to push into it
##
- git ls-remote --exit-code -h "$GIT_INTRA_REPO_URL" || { [ $? -ne 2 ] && return 1; }
##
## Get intra repo reference
##
- git remote | grep 'intra' || git remote add intra "$GIT_INTRA_REPO_URL"
- git remote update
##
## Debug dumping
##
- git log --all --oneline --graph --decorate
##
## Push tag
##
- git push intra "$CI_COMMIT_TAG"
release-job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG != null
needs:
- job: push-tag-to-intra-job
artifacts: false
script:
- echo "creating a new release for tag $CI_COMMIT_TAG..."
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
|