-
Notifications
You must be signed in to change notification settings - Fork 4
181 lines (177 loc) · 6.82 KB
/
pages.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
181
# Copyright (C) The DDC development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT
name: pages
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref == github.ref_protected && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
id_repo:
runs-on: ubuntu-latest
outputs: { in_base_repo: '${{ steps.identify_repo.outputs.in_base_repo }}' }
steps:
- name: Identify repository
id: identify_repo
run: |
echo "in_base_repo=${{ (github.event_name == 'push' && github.repository == 'CExA-project/ddc') || github.event.pull_request.head.repo.full_name == 'CExA-project/ddc' }}" >> "$GITHUB_OUTPUT"
docker-build:
needs: id_repo
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with: { tool-cache: true, large-packages: false }
- name: Checkout built branch
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
DOCKER_BUILDKIT=1 docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} \
docker/doxygen
- name: Publish image for current SHA
if: needs.id_repo.outputs.in_base_repo == 'true'
run: |
docker push ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7}
- name: Publish latest (default) image
if: github.event_name == 'push' && github.ref_name == 'main' && needs.id_repo.outputs.in_base_repo == 'true'
run: |
docker push ghcr.io/cexa-project/ddc/doxygen
- name: Create image tarball
if: needs.id_repo.outputs.in_base_repo == 'false'
run: |
docker save ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} > doxygen.tar
- name: Generate docker artifact from image
if: needs.id_repo.outputs.in_base_repo == 'false'
uses: actions/upload-artifact@v4
with:
name: doxygen-artifact
path: doxygen.tar
retention-days: 1
check-doc:
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with: { tool-cache: true, large-packages: false }
- name: Checkout built branch
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Collect image artifact
if: needs.id_repo.outputs.in_base_repo == 'false'
uses: actions/download-artifact@v4
with: { name: 'doxygen-artifact' }
- name: Load image artifact into docker
if: needs.id_repo.outputs.in_base_repo == 'false'
run: |
docker load < doxygen.tar
rm doxygen.tar
- name: Generate documentation
run: |
cat<<-EOF > run.sh
set -xe
git config --global --add safe.directory '*'
cmake \
-DDDC_BUILD_DOCUMENTATION=ON \
-DCMAKE_CXX_STANDARD=20 \
-DDOXYGEN_EXTRACT_ALL=NO \
-DDOXYGEN_WARN_IF_UNDOCUMENTED=YES \
-DDOXYGEN_WARN_IF_DOC_ERROR=YES \
-DDOXYGEN_WARN_IF_INCOMPLETE_DOC=YES \
-DDOXYGEN_WARN_NO_PARAMDOC=YES \
-DDOXYGEN_WARN_IF_UNDOC_ENUM_VAL=YES \
-DDOXYGEN_WARN_AS_ERROR=NO \
-DMDSPAN_CXX_STANDARD=20 \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-B build \
-S /src
cmake --build build --verbose --target doc
mv build/docs/doxygen.log /src/docs_out/doxygen.log
EOF
mkdir docs_out
chmod a+rwx docs_out
docker run -v ${PWD}:/src ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} bash /src/run.sh
- name: Check for relevant documentation errors
run: |
# Get files which have changed in this merge request
git diff ${{github.event.pull_request.base.sha}}..HEAD --name-only --output=pull_diff.txt include/ddc/kernels/
# Search through modified files to find relevant errors
touch relevant_errors.txt
while read f; do
echo "Looking for $f"
grep "$f" docs_out/doxygen.log 2>&1 | tee -a relevant_errors.txt
done < pull_diff.txt
if [ -s relevant_errors.txt ]; then
# The file is not-empty.
exit 1
fi
pages:
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with: { tool-cache: true, large-packages: false }
- name: Checkout built branch
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Collect image artifact
if: needs.id_repo.outputs.in_base_repo == 'false'
uses: actions/download-artifact@v4
with: { name: 'doxygen-artifact' }
- name: Load image artifact into docker
if: needs.id_repo.outputs.in_base_repo == 'false'
run: |
docker load < doxygen.tar
rm doxygen.tar
- name: Build site
run: |
cat<<-EOF > run.sh
set -xe
git config --global --add safe.directory '*'
export CC=clang
export CXX=clang++
cmake \
-DDDC_BUILD_DOCUMENTATION=ON \
-DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-B build \
-S /src
cmake --build build --verbose --target doc
mv build/docs/html /src/docs_out
mv build/docs/doxygen.log /src/docs_out/doxygen.log
EOF
mkdir docs_out
chmod a+rwx docs_out
docker run -v ${PWD}:/src ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} bash /src/run.sh
head -n 10 docs_out/doxygen.log
- name: Publish site
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && needs.id_repo.outputs.in_base_repo == 'true' }}
run: |
git fetch origin gh-pages
git worktree add -B gh-pages public remotes/origin/gh-pages
find public -mindepth 1 -maxdepth 1 '!' -name .git -exec rm -rf '{}' '+'
cp -a docs_out/html/* public/
echo "ddc.mdls.fr" > public/CNAME
git -C public config user.name "${GITHUB_ACTOR}"
git -C public config user.email "${GITHUB_ACTOR}@noreply.example.com"
git -C public add -A .
git -C public commit -a -m "Update to match ${GITHUB_SHA} by ${GITHUB_EVENT_NAME} ${GITHUB_RUN_NUMBER}" || true
git -C public push