forked from Xilinx/finn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
180 lines (173 loc) · 5.62 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
stages:
- sync
- singularity_build
- load_deps
- test
variables:
PIPELINE_NAME:
description: "Optional name to better identify this pipeline"
value: ""
TEST_SUITE:
description: "Select test suite to run"
value: "full"
options:
- "none"
- "quicktest"
- "full"
CPU_CORES:
description: "Select number of CPU cores and test workers"
value: "8"
PARALLEL_JOBS:
description: "Number of parallel Slurm array jobs per Benchmark job"
value: "2"
SLURM_TIMEOUT:
description: "Select SLURM timeout"
value: "3-0" # [days-hours]
SLURM_PARTITION:
description: "Slurm partition (e.g., normal, largemem, fpga, gpu)"
value: "normal"
SLURM_QOS:
description: "Optional QoS option (include --qos, e.g., --qos express)"
value: ""
MANUAL_CFG_PATH:
description: "Use this config file instead of configs stored in the repo. Path must be accessible to runner"
value: ""
FINN_XILINX_VERSION:
value: "2022.2"
workflow:
name: '$PIPELINE_NAME'
rules:
# Run pipeline for GitHub PRs to dev (does not support PRs from forks)
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event" && $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "dev"
# Run pipeline for pushes to dev
- if: $CI_COMMIT_BRANCH == "dev"
# Run pipeline if manually triggered via API or web GUI
- if: $CI_PIPELINE_SOURCE == "api"
- if: $CI_PIPELINE_SOURCE == "web"
# Run pipeline if scheduled (only for nightly sync of finn-dev)
- if: $CI_PIPELINE_SOURCE == "schedule"
Sync finn-dev:
id_tokens:
CI_JOB_JWT:
aud: https://git.uni-paderborn.de
stage: sync
tags:
# Run where full Docker + Singularity is available
- image_build
rules:
# Only run on a schedule
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- mkdir -p ../github_clone && cd ../github_clone
- rm -rf finn-plus # Ensure we do a fresh clone (TODO: better way to handle this on job level?)
- git clone [email protected]:eki-project/finn-plus.git && cd finn-plus
- git remote add upstream https://github.com/Xilinx/finn.git
- git checkout finn-dev
- git pull upstream dev
- git push origin finn-dev
Singularity Image Build:
id_tokens:
CI_JOB_JWT:
aud: https://git.uni-paderborn.de
stage: singularity_build
tags:
# Run where full Docker + Singularity is available
- image_build
rules:
# Do not run on a schedule
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
# Always run for dev branch to ensure default image is up to date
- if: $CI_COMMIT_REF_SLUG == "dev"
# For other branches only run if relevant files changed relative to dev branch
- changes:
paths:
- requirements.txt
- docker/Dockerfile.finn
- docker/finn_entrypoint.sh
- docker/quicktest.sh
compare_to: "dev"
script:
- docker build --no-cache -f docker/Dockerfile.finn --tag=finn_docker_export .
- apptainer build --force finn_singularity_image.sif docker-daemon://finn_docker_export:latest
- rsync -vh finn_singularity_image.sif $PATH_SINGULARITY_IMG_BUILD/finn-plus/finn_$CI_COMMIT_REF_SLUG.sif
- echo SINGULARITY_IMG_SELECT=finn_$CI_COMMIT_REF_SLUG.sif > FINN_environment.env
after_script: # Clean caches
- echo 'y' | docker image prune
- echo 'y' | docker builder prune
- echo 'y' | apptainer cache clean
# Save env var selecting Singularity image to be used in subsequent jobs
artifacts:
reports:
dotenv: FINN_environment.env
Fetch Repos:
id_tokens:
CI_JOB_JWT:
aud: https://git.uni-paderborn.de
stage: load_deps
tags:
- login
rules:
# Do not run on a schedule
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
# Otherwise run
- when: always
cache:
key: $CI_COMMIT_SHA
paths:
- deps
variables:
SINGULARITY_IMG_SELECT: "finn_dev.sif" # default, may be overwritten by dotenv artifact
script:
- ./fetch-repos.sh
# Workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/349538
# Passing artifacts from optional parent jobs to child pipelines is not supported
# Therefore, we pass the dotenv artifact from "Singularity Image Build" through this job
- echo SINGULARITY_IMG_SELECT=$SINGULARITY_IMG_SELECT > FINN_environment_passthrough.env
artifacts:
reports:
dotenv: FINN_environment_passthrough.env
FINN Test Suite 2022.2:
id_tokens:
CI_JOB_JWT:
aud: https://git.uni-paderborn.de
stage: test
rules:
# Do not run on a schedule
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
# Do not run if test suite has been deselected
- if: $TEST_SUITE == "none"
when: never
# Always run, as long as there was no prior failure
- when: on_success
cache:
key: $CI_COMMIT_SHA
policy: pull
paths:
- deps
variables:
SCHEDULER_PARAMETERS: "-A $PROJECT_ACCOUNT -p $SLURM_PARTITION -t $SLURM_TIMEOUT $SLURM_QOS --nodes 1 --ntasks 1 --cpus-per-task $CPU_CORES --exclusive"
PYTEST_PARALLEL: "$CPU_CORES"
FINN_XILINX_VERSION: "2022.2"
before_script:
- cp -dfR .. $PATH_WORKDIR # Copy to working directory (e.g. RAMdisk)
- cd $PATH_WORKDIR/finn-plus
- chmod 755 ./test.sh
- module load system singularity
- ulimit -s unlimited # Increase stack size limit
- export FINN_SINGULARITY=$PATH_SINGULARITY_IMG/finn-plus/$SINGULARITY_IMG_SELECT
script:
- ./run-docker.sh ./test.sh $TEST_SUITE
artifacts:
name: "test_reports"
when: always
paths:
- reports/
reports:
junit: reports/*.xml
FINN Test Suite 2024.1:
extends: FINN Test Suite 2022.2
variables:
FINN_XILINX_VERSION: "2024.1"