-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
95 lines (89 loc) · 3 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
workflow:
rules:
# Run pipeline on tags for the main project
- if: $CI_COMMIT_TAG && $CI_PROJECT_PATH == "xcompact3d/x3d2"
# Run pipeline on the default branch for the main project
- if: $CI_COMMIT_BRANCH == "main" && $CI_PROJECT_PATH == "xcompact3d/x3d2"
# DO NOT run pipeline if Draft
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(\[Draft\]|\(Draft\)|Draft:).*/
when: never
# Other merge requests trigger pipelines
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event"
changes:
compare_to: 'refs/heads/main'
paths:
- "src/**/*"
- "examples/**/*"
- "tests/**/*"
- .gitlab-ci.yml
stages:
- build-and-test
- check-policies
.build-and-test-template: &build-and-test-template
image: ubuntu:22.04
stage: build-and-test
timeout: 1h
script:
- echo "Setup environment"
- apt update
- apt install -y environment-modules
- echo "/apps/modules" >> /etc/environment-modules/modulespath
- apt-get update
- apt-get install -y ccache
- apt-get install -y cmake
- apt-get install -y git
- apt-get install -y gcc
- apt-get install -y infiniband-diags ibverbs-utils
- apt-get install -y libibverbs-dev libfabric1 libfabric-dev libpsm2-dev
- apt-get install -y openmpi-bin openmpi-common libopenmpi-dev libgtk2.0-dev
- apt-get install -y librdmacm-dev libpsm2-dev
- . /etc/profile.d/modules.sh
- ccache -s && ccache -M 5G
- if [ "${EXTRA_MODULE}" != "" ]; then module load "${EXTRA_MODULE}"; fi
- echo "Configure Debug build"
- FC=mpif90 cmake -S . -B build "-DCMAKE_BUILD_TYPE=Debug ${BUILD_FORTRAN}"
- echo "Build with Debug (strict) flags"
- make -C build
- echo "Configure Release build"
- FC=mpif90 cmake -S . -B build "-DCMAKE_BUILD_TYPE=Release ${BUILD_FORTRAN}"
- echo "Build tests"
- make -C build
- echo "Run the tests"
- export OMPI_ALLOW_RUN_AS_ROOT=1
- export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
- make -C build test
tags:
- gpu
.check-formatting-template: &check-formatting-template
image: python:3.9.19-bullseye
stage: check-policies
variables:
FPRETTIFY_COMMAND: fprettify --config .fprettify.ini --diff --recursive src
before_script:
- pip install fprettify
script:
- cd $CI_PROJECT_DIR
- $FPRETTIFY_COMMAND &> fprettify.log
- if [[ ! -z "$(cat fprettify.log)" ]]; then echo "::warning::Code formatting issues detected. See log for details."; exit 1; fi
allow_failure: false
timeout: 15m
artifacts:
expire_in: 1 month
when: on_failure
paths:
- fprettify.log
build-and-test:
<<: *build-and-test-template
needs: []
variables:
EXTRA_MODULE: ""
BUILD_FORTRAN: "-DCMAKE_Fortran_COMPILER=gcc"
build-and-test-cuda:
<<: *build-and-test-template
needs: []
variables:
EXTRA_MODULE: "cuda-hpc-sdk"
BUILD_FORTRAN: "-DCMAKE_Fortran_COMPILER=nvfortran"
check-formatting:
<<: *check-formatting-template
needs: []