populating cache before hand #516
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cmake ci linux macos windows | |
on: [push, pull_request] | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.generate_matrix.outputs.matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Generate matrix | |
id: generate_matrix | |
run: | | |
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV | |
MATRIX=$(python3 ${{ github.workspace }}/.github/workflows/generate_cmake_matrix.py) | |
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
cmake : true | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
with: | |
key: 'default' | |
path: CPM | |
- name: Download dependencies in cache | |
run: | | |
cmake -S . -B ./build | |
cmake -S . -B ./build -DFINUFFT_USE_DUCC0=ON | |
cmake-ci: | |
runs-on: ${{ matrix.os }} | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Restore Cache | |
uses: actions/cache/restore@v4 | |
with: | |
key: 'default' | |
path: CPM | |
enableCrossOsArchive: true | |
- name: Run sccache-cache only on non-release runs | |
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | |
uses: mozilla-actions/sccache-action@v0.0.7 | |
- name: Set Rust caching env vars only on non-release runs | |
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | |
run: | | |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
echo "SCCACHE_GHA_VERSION=0" >> $GITHUB_ENV | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.toolchain }} | |
vcvarsall: ${{ contains(matrix.os, 'windows') }} | |
cmake: true | |
ninja: true | |
vcpkg: false | |
cppcheck: false | |
clangtidy: false | |
- name: Set min macOS version and install fftw | |
if: runner.os == 'macOS' | |
run: | | |
brew install fftw | |
- name: Install fftw | |
if: runner.os == 'linux' | |
run: | | |
sudo apt update | |
sudo apt install -y libfftw3-dev | |
- name: Configure Cmake | |
run: | | |
cmake -S . -B ./build -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DFINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }} -DFINUFFT_BUILD_TESTS=ON -DFINUFFT_STATIC_LINKING=${{matrix.finufft_static_linking}} -DFINUFFT_USE_DUCC0=${{ matrix.ducc_fft }} | |
env: | |
CPM_SOURCE_CACHE: ${{ matrix.cache_path }} | |
- name: Build | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: Test | |
working-directory: ./build | |
run: | | |
ctest -C ${{matrix.build_type}} --output-on-failure | |
- name: Set up Python | |
if: matrix.finufft_static_linking == 'off' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Build Python wheels | |
if: matrix.finufft_static_linking == 'off' | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 13 | |
CPM_SOURCE_CACHE: ${{ matrix.cache_path }} | |
shell: bash | |
run: | | |
python3 -m pip install \ | |
--verbose \ | |
-C cmake.define.CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-C cmake.define.FINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }} \ | |
-C cmake.define.FINUFFT_USE_DUCC0=${{ matrix.ducc_fft }} \ | |
-C cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=sccache \ | |
-C cmake.define.CMAKE_C_COMPILER_LAUNCHER=sccache \ | |
python/finufft | |
- name: Install pytest | |
if: matrix.finufft_static_linking == 'off' | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install pytest | |
- name: Test Python package | |
if: matrix.finufft_static_linking == 'off' | |
run: | | |
python3 -m pytest python/finufft/test |