Skip to content

Use cmake GNUInstallDirs variables #3262

Use cmake GNUInstallDirs variables

Use cmake GNUInstallDirs variables #3262

Workflow file for this run

# 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