mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-10-21 01:26:17 +02:00
- Use sccache: https://github.com/mozilla/sccache to speed up CI - Not huge benefits for Windows but mac and linux really improves
97 lines
2.5 KiB
YAML
97 lines
2.5 KiB
YAML
name: Build the package using cmake then documentation
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
pull_request:
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
env:
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
|
BUILD_TYPE: Debug
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: [ubuntu-latest, macos-latest]
|
|
python-version: ["3.12",]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
env:
|
|
# sccache keeps compiled objects in the GitHub Actions cache
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
defaults:
|
|
run:
|
|
shell: "bash -l {0}"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Get conda
|
|
uses: conda-incubator/setup-miniconda@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
environment-file: etc/dev-env.yml
|
|
miniforge-version: latest
|
|
channels: conda-forge
|
|
conda-remove-defaults: "true"
|
|
|
|
- uses: mozilla-actions/sccache-action@v0.0.11
|
|
with:
|
|
version: "v0.18.0"
|
|
|
|
# Precompiled headers are disabled because sccache does not cache
|
|
# compilations that use one
|
|
- name: Build library and docs
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAARE_SYSTEM_LIBRARIES=ON -DAARE_PYTHON_BINDINGS=ON -DAARE_DOCS=ON -DAARE_TESTS=ON -DAARE_WARNINGS_AS_ERRORS=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
|
|
make -j 4
|
|
make docs
|
|
|
|
- name: Compiler cache statistics
|
|
run: sccache --show-stats
|
|
|
|
- name: C++ unit tests
|
|
working-directory: ${{github.workspace}}/build
|
|
run: ctest -C ${{env.BUILD_TYPE}} -j4
|
|
|
|
|
|
- name: Python unit tests
|
|
working-directory: ${{github.workspace}}/build
|
|
run: python -m pytest ${{github.workspace}}/python/tests/
|
|
|
|
- name: Upload static files as artifact
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
id: deployment
|
|
uses: actions/upload-pages-artifact@v5
|
|
with:
|
|
path: build/docs/html/
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' )
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v5
|
|
|
|
|
|
|
|
|