Skip to content

CI(MacOS): install numpy through homebrew to make it detectable for C… #801

CI(MacOS): install numpy through homebrew to make it detectable for C…

CI(MacOS): install numpy through homebrew to make it detectable for C… #801

Workflow file for this run

---
name: CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_ENABLE_PINNING=ON
-DSPIRIT_ENABLE_DEFECTS=ON
SOURCES: >
find
core/include/
core/src/
ui-cpp/utility/
ui-cpp/ui-imgui/include/
ui-cpp/ui-imgui/src/
-iname *.hpp -o -iname *.cpp"
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install required system packages
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev tree
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: πŸ“š Install python packages
run: >
pip install --user numpy pylint
"black==22.10.0"
"clang-format==18.1.8"
"clang-tidy==18.1.8"
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ§ͺ clang-format linting
if: always()
shell: bash
run: |
clang-format --version
OUTPUT=$($SOURCES | xargs clang-format -n 2>&1)
if [[ $OUTPUT ]]; then
echo "$OUTPUT"
exit 1
fi
- name: πŸ§ͺ clang-tidy linting
if: always()
shell: bash
run: |
clang-tidy --version
- name: πŸ§ͺ Python code formatting check
shell: bash
run: |
git ls-files core/python/{,**/}*.py | xargs black --check
git ls-files ui-python/{,**/}*.py | xargs black --check
- name: πŸ§ͺ Python code quality checks, linting
shell: bash
run: pylint core/python/spirit --fail-under=8
test-gcc:
name: gcc ${{ matrix.parallelisation }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-22.04
parallelisation: "openmp"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install required system packages
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: βš™ Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DSPIRIT_USE_OPENMP=ON
$CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-clang:
name: clang ${{ matrix.parallelisation }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
parallelisation: ""
- os: ubuntu-24.04
parallelisation: "openmp"
# this build cannot be configured currently
# - os: ubuntu-24.04
# parallelisation: "cuda"
- os: macos-14
parallelisation: ""
- os: macos-14
parallelisation: "openmp"
- os: windows-2022
parallelisation: ""
- os: windows-2022
parallelisation: "openmp"
env:
BUILD_TYPE: Release
BUILD_SYSTEM_FLAG: ${{ matrix.os == 'windows-2022' && '-G Ninja' || '' }}
CMAKE_FLAGS: >
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install LLVM 17 and some libs (Ubuntu)
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev clang-17 lldb-17 lld-17 libomp-17-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 10
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 10
clang --version
- name: πŸ“š Install CUDA Toolkit
if: matrix.parallelisation == 'cuda'
shell: bash
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-5
echo "/usr/local/cuda-12.5/bin" >> $GITHUB_PATH
echo "/usr/local/cuda-12.5/lib64" >> $GITHUB_PATH
# Workaround, because the setup-python action doesn't set up the PATH correctly
- name: πŸ“š Install LLVM and numpy (MacOS)
if: matrix.os == 'macos-14'
shell: bash
run: |
brew update
brew install llvm numpy
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: πŸ“š Install LLVM and Ninja (Windows)
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
choco install llvm ninja -y
choco upgrade llvm
- uses: actions/setup-python@v5
if: matrix.os != 'macos-14'
with:
python-version: '3.x'
- name: πŸ“š Install python packages
if: matrix.os != 'macos-14'
run: pip install --user numpy
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
$BUILD_SYSTEM_FLAG
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
- name: βš™ Configure with CUDA
if: matrix.parallelisation == 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
CUDA_PATH=/usr/local/cuda-12.5
cmake $GITHUB_WORKSPACE
-DCMAKE_CUDA_COMPILER=clang++
-DSPIRIT_CUDA_ARCH=70
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_CUDA=ON
- name: βš™ Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
$BUILD_SYSTEM_FLAG
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_OPENMP=ON
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test
if: matrix.parallelisation != 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-nvcpp:
name: nvcpp ${{ matrix.parallelisation }} (ubuntu-22.04)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- parallelisation: ""
# - parallelisation: "openmp" # Some OpenMP that Spirit uses isn't supported by nvc++
- parallelisation: "cuda"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DCMAKE_CXX_COMPILER=nvc++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: Force upgrade to gcc-12 on Ubuntu 22.04
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10
- name: πŸ“š Install NVIDIA HPC SDK and some libs
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y nvhpc-24-5
echo "/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin" >> $GITHUB_PATH
echo "/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/math_libs/lib64" >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: βš™ Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_OPENMP=ON
- name: βš™ Configure with CUDA
if: matrix.parallelisation == 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_CUDA=ON
-DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/cuda/
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test
if: matrix.parallelisation != 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-msvc:
name: msvc (windows-2022)
runs-on: windows-2022
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
steps:
- uses: actions/checkout@v4
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-debug:
name: test debug (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: macos-14
env:
BUILD_TYPE: Debug
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=OFF
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
EXCLUDETESTS: solver
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure (without coverage)
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test regular debug build
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --output-on-failure
test-coverage:
name: test coverage (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
env:
BUILD_TYPE: Debug
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=OFF
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: πŸ“š Install coverage packages
run: |
python -m pip install --upgrade pip
python -m pip install coverage 'coveralls<3'
sudo apt-get update
sudo apt-get install -y lcov
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure (with coverage)
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DSPIRIT_TEST_COVERAGE=ON
$CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Generate C++ coverage
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -i --no-external --directory . --base-directory $GITHUB_WORKSPACE/core -o baseline.info
make test
lcov -c --no-external --directory . --base-directory $GITHUB_WORKSPACE/core -o after_test.info
lcov -a baseline.info -a after_test.info -o total_test.info
lcov -r total_test.info \*thirdparty\* \*/test/\* \*Collection\* \*DLL_\* -o coverage.info
- name: ⬆ Upload C++ coverage
uses: codecov/codecov-action@v3
with:
files: ${{runner.workspace}}/build/coverage.info
- name: πŸ§ͺ Generate Python API coverage
if: matrix.coverage == true
working-directory: ./core/python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage run --source spirit --omit=spirit/spiritlib.py \
-m unittest discover \
--start-directory ./test \
--pattern "*.py" \
> cov.txt
head cov.txt
coverage report -m
coverage xml
coveralls
test-other-configurations:
name: test ${{ matrix.configuration }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- configuration: "single-precision"
os: ubuntu-24.04
- configuration: "single-precision"
os: macos-14
- configuration: "pinning-and-defects"
os: ubuntu-24.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- name: Force install of gcc-13 on Ubuntu 24.04
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10
- name: πŸ“š Install required system packages
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure single-precision build
if: matrix.configuration == 'single-precision'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DSPIRIT_SCALAR_TYPE="float"
$CMAKE_FLAGS
- name: βš™ Configure pinning-and-defects build
if: matrix.configuration == 'pinning-and-defects'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$Debug
-DSPIRIT_ENABLE_PINNING=ON
-DSPIRIT_ENABLE_DEFECTS=ON
$CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
build-cuda:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-22.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=OFF
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_USE_CUDA=ON
-DSPIRIT_CUDA_ARCH=70
steps:
- uses: actions/checkout@v4
- name: Force downgrade to gcc-10 on Ubuntu 22.04 to avoid a bug in gcc-11.3 header
if: matrix.config.os == 'ubuntu-22.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-10 cmake
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
- name: πŸ“š Install CUDA
shell: bash
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install -y cuda-toolkit-12-4
echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
echo "/usr/local/cuda-12.4/lib64" >> $GITHUB_PATH
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
CUDA_PATH=/usr/local/cuda
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
build-ui-qt:
runs-on: ubuntu-20.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=ON
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install Qt5
run: |
sudo apt-get update
sudo apt-get install -y qt5-default libqt5charts5-dev
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
build-webapp:
name: webapp ${{ matrix.target }} (ubuntu-22.04)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- target: "mobile"
- target: "desktop"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_BUILD_FOR_JS=ON
EMSCRIPTEN_VERSION: "3.1.38"
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install Emscripten
working-directory: ${{runner.workspace}}
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install $EMSCRIPTEN_VERSION
./emsdk activate $EMSCRIPTEN_VERSION
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure (mobile)
if: matrix.target == 'mobile'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
source ${{runner.workspace}}/emsdk/emsdk_env.sh;
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DSPIRIT_UI_USE_IMGUI=OFF
$CMAKE_FLAGS
-DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
- name: βš™ Configure (desktop)
if: matrix.target == 'desktop'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
source ${{runner.workspace}}/emsdk/emsdk_env.sh;
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DSPIRIT_UI_USE_IMGUI=ON $CMAKE_FLAGS
-DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
source ${{runner.workspace}}/emsdk/emsdk_env.sh
cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ“¦ Archive mobile web app
if: matrix.target == 'mobile'
uses: actions/upload-artifact@v4
with:
name: webapp-mobile
path: ui-web/
if-no-files-found: error
- name: πŸ“¦ Archive desktop web app
if: matrix.target == 'desktop'
uses: actions/upload-artifact@v4
with:
name: webapp-desktop
path: ui-cpp/ui-imgui/webapp/
if-no-files-found: error
deploy-pypi:
if: github.event_name != 'pull_request'
needs:
- lint
- test-gcc
- test-clang
- test-nvcpp
- test-msvc
- test-debug
- test-coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF
SPIRIT_ADD_VERSION_SUFFIX: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: βš™ Configure environment
shell: bash
if: github.ref == 'refs/heads/master'
run: echo "SPIRIT_ADD_VERSION_SUFFIX=false" >> $GITHUB_ENV
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: πŸ“š Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy setuptools wheel twine
- name: πŸ›  Build Python package
shell: bash
working-directory: ./core/python
run: |
echo "Python package build"
echo "Add suffix to spirit version tag for python package $SPIRIT_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel
- name: πŸš€ Deploy to TestPyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*
- name: πŸš€ Deploy to PyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*
deploy-package:
if: github.event_name != 'pull_request'
needs:
- lint
- test-gcc
- test-clang
- test-nvcpp
- test-msvc
- test-debug
- test-coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_BUNDLE_APP=ON
steps:
- uses: actions/checkout@v4
- name: πŸ“š Install required system packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: βš™ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: πŸ›  Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE -j 2
cmake --install .
cmake --build . --config $BUILD_TYPE -j 2 --target package
- name: πŸ“¦ Archive ubuntu package
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: spirit-ubuntu
path: ${{runner.workspace}}/build/*.tar.gz
if-no-files-found: error
- name: πŸ“¦ Archive macOS package
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: spirit-macos
path: |
${{runner.workspace}}/build/*.dmg
${{runner.workspace}}/build/install/README.md
${{runner.workspace}}/build/install/LICENSE.txt
${{runner.workspace}}/build/install/VERSION.txt
${{runner.workspace}}/build/install/licenses/
if-no-files-found: error
- name: πŸ“¦ Archive windows package
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: spirit-windows
path: ${{runner.workspace}}/build/*.zip
if-no-files-found: error
draft-release:
if: github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
needs: [deploy-pypi, deploy-package, build-webapp]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: πŸ“„ Generate a changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ“„ Print the changelog
run: echo "${{ steps.changelog.outputs.changelog }}"
- name: πŸŽ‰ Create draft release
id: draft_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
draft: true