-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
134 lines (126 loc) · 4.22 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
workflow:
rules:
# Run pipeline on tags for the main project
- if: $CI_COMMIT_TAG && $CI_PROJECT_PATH == "CFD-Xing/x3d2"
# Run pipeline on the default branch for the main project
- if: $CI_COMMIT_BRANCH == "main" && $CI_PROJECT_PATH == "CFD-Xing/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-docs
.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-docs-template: &build-docs-template
image: python:3.9.19-slim-bookworm
stage: build-docs
variables:
PUBLISH_DIR: api/
FORD_OUTPUT_DIR: api-docs
FORD_CFG: ford.md
script:
- cd $CI_PROJECT_DIR
- apt update
- apt install -y git
- echo Install sphinx, ford and ghp-import
- pip install -r docs/docs-requirements.txt
- echo Install graphviz
- apt install graphviz -y
- echo Build sphinx docs
- apt-get install make -y
- make -C docs html
- echo Deploy sphinx docs
- git config user.name 'github-action'
- git config user.email 'github-action'
- git remote add upstream [email protected]:xcompact3d/x3d2.git
- ghp-import -m 'Update sphinx docs' --push --remote upstream --branch gh-pages docs/build/html --no-jekyll --force
- echo Build API docs with ford
- ford $FORD_CFG -o $FORD_OUTPUT_DIR
- echo Deploy api-docs
- ghp-import -m 'Update API docs' --prefix $PUBLISH_DIR --push --remote upstream --branch gh-pages $FORD_OUTPUT_DIR --no-jekyll --force
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
- when: never
allow_failure: false
timeout: 15m
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: []
#build-docs:
# <<: *build-docs-template
# needs: []