Skip to content

Develop update

Develop update #773

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@v3
- 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@v4
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@v3
- 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@v4
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 --rerun-failed --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"
- os: ubuntu-24.04
parallelisation: "cuda"
- os: macos-13
parallelisation: ""
- os: macos-13
parallelisation: "openmp"
- os: windows-2022
parallelisation: ""
- os: windows-2022
parallelisation: "openmp"
env:
BUILD_TYPE: Release
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@v3
- 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
- name: πŸ“š Install LLVM (MacOS)
if: matrix.os == 'macos-13'
shell: bash
run: |
brew update
brew install llvm
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
if ($env:CMAKE_FLAGS) {
$env:CMAKE_FLAGS = "$env:CMAKE_FLAGS -G Ninja"
} else {
$env:CMAKE_FLAGS = "-G Ninja"
}
"CMAKE_FLAGS=$env:CMAKE_FLAGS" | Out-File -FilePath $env:GITHUB_ENV -Append
- uses: actions/setup-python@v4
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 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 -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 --rerun-failed --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@v3
- 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@v4
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/23.3/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 --rerun-failed --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@v3
- name: πŸ“ Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- uses: actions/setup-python@v4
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 --rerun-failed --output-on-failure
test-debug-coverage:
name: test debug and coverage (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
coverage: true
- os: macos-13
- os: windows-2022
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@v3
- uses: actions/setup-python@v4
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)
if: matrix.coverage != true
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: βš™ Configure (with coverage)
if: matrix.coverage == true
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: πŸ§ͺ Test regular debug build
if: matrix.coverage != true
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --rerun-failed --output-on-failure
- name: πŸ“š Install coverage packages
if: matrix.coverage == true
run: |
python -m pip install --upgrade pip
python -m pip install coverage 'coveralls<3' wheel
sudo apt-get update
sudo apt-get install -y lcov
- name: πŸ§ͺ Generate C++ coverage
if: matrix.coverage == true
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
if: matrix.coverage == true
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 setup.py test > 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-22.04
- configuration: "single-precision"
os: macos-13
- configuration: "single-precision"
os: windows-2022
- configuration: "pinning-and-defects"
os: ubuntu-22.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@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: πŸ“š Install python packages
run: pip install --user numpy
- 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
- 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=$BUILD_TYPE -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 --rerun-failed --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@v3
- 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@v3
- 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@v3
- 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@v3
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@v3
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-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@v3
- uses: actions/setup-python@v4
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-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@v3
- 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@v3
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@v3
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@v3
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@v3
- 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