@@ -4,7 +4,7 @@ on: [push, pull_request]
44
55jobs :
66 prepare :
7- runs-on : ubuntu-latest
7+ runs-on : ubuntu-22.04
88 outputs :
99 matrix : ${{ steps.generate_matrix.outputs.matrix }}
1010 steps :
@@ -13,18 +13,71 @@ jobs:
1313 - name : Generate matrix
1414 id : generate_matrix
1515 run : |
16- echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
1716 MATRIX=$(python3 ${{ github.workspace }}/.github/workflows/generate_cmake_matrix.py)
1817 echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
18+ cache :
19+ strategy :
20+ matrix :
21+ os :
22+ - ubuntu-22.04
23+ - windows-2022
24+ runs-on : ${{ matrix.os }}
25+ steps :
26+ - name : Checkout code
27+ uses : actions/checkout@v4
28+ - name : create cache directory
29+ run : |
30+ mkdir -p cpm
31+ - name : Setup Cpp
32+ if : steps.cache.outputs.cache-hit != 'true'
33+ uses : aminya/setup-cpp@v1
34+ with :
35+ cmake : true
36+ - name : Download dependencies in cache linux
37+ if : steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
38+ run : |
39+ cmake -S . -B ./build
40+ rm -rf build
41+ cmake -S . -B ./build -DFINUFFT_USE_DUCC0=ON
42+ env :
43+ CPM_SOURCE_CACHE : cpm
44+ - name : Download dependencies in cache windows
45+ if : steps.cache.outputs.cache-hit != 'true' && runner.os != 'Linux'
46+ run : |
47+ cmake -S . -B build
48+ rm build -r -force
49+ cmake -S . -B build -DFINUFFT_USE_DUCC0=ON
50+ env :
51+ CPM_SOURCE_CACHE : cpm
52+ - name : Cache dependencies
53+ uses : actions/cache/save@v4
54+ with :
55+ key : cpm-cache-00-${{ hashFiles('CMakeLists.txt', 'cmake/*') }}
56+ enableCrossOsArchive : true
57+ path : cpm
1958 cmake-ci :
2059 runs-on : ${{ matrix.os }}
21- needs : prepare
60+ needs : [ prepare, cache]
2261 strategy :
2362 fail-fast : false
2463 matrix : ${{ fromJSON(needs.prepare.outputs.matrix) }}
2564 steps :
2665 - name : Checkout code
2766 uses : actions/checkout@v4
67+ - name : Restore Cache
68+ uses : actions/cache/restore@v4
69+ with :
70+ key : cpm-cache-00-${{ hashFiles('CMakeLists.txt', 'cmake/*') }}
71+ enableCrossOsArchive : true
72+ path : cpm
73+ - name : Run sccache-cache only on non-release runs
74+ if : github.event_name != 'release' && github.event_name != 'workflow_dispatch'
75+ uses :
mozilla-actions/[email protected] 76+ - name : Set caching env vars only on non-release runs
77+ if : github.event_name != 'release' && github.event_name != 'workflow_dispatch'
78+ run : |
79+ echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
80+ echo "SCCACHE_GHA_VERSION=0" >> $GITHUB_ENV
2881 - name : Setup Cpp
2982 uses : aminya/setup-cpp@v1
3083 with :
4699 sudo apt install -y libfftw3-dev
47100 - name : Configure Cmake
48101 run : |
49- cmake -S . -B ./build -G Ninja -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 }}
102+ 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 }}
103+ env :
104+ CPM_SOURCE_CACHE : cpm
50105 - name : Build
51106 run : |
52107 cmake --build ./build --config ${{matrix.build_type}}
@@ -57,31 +112,34 @@ jobs:
57112 ctest -C ${{matrix.build_type}} --output-on-failure
58113
59114 - name : Set up Python
60- if : matrix.finufft_static_linking
115+ if : matrix.finufft_static_linking == 'off'
61116 uses : actions/setup-python@v5
62117 with :
63118 python-version : ' 3.10'
64119
65120 - name : Build Python wheels
66- if : matrix.finufft_static_linking
121+ if : matrix.finufft_static_linking == 'off'
67122 env :
68123 MACOSX_DEPLOYMENT_TARGET : 13
124+ CPM_SOURCE_CACHE : cpm
69125 shell : bash
70126 run : |
71127 python3 -m pip install \
72128 --verbose \
73129 -C cmake.define.CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
74130 -C cmake.define.FINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }} \
75131 -C cmake.define.FINUFFT_USE_DUCC0=${{ matrix.ducc_fft }} \
132+ -C cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=sccache \
133+ -C cmake.define.CMAKE_C_COMPILER_LAUNCHER=sccache \
76134 python/finufft
77135
78136 - name : Install pytest
79- if : matrix.finufft_static_linking
137+ if : matrix.finufft_static_linking == 'off'
80138 run : |
81139 python3 -m pip install --upgrade pip
82140 python3 -m pip install pytest
83141
84142 - name : Test Python package
85- if : matrix.finufft_static_linking
143+ if : matrix.finufft_static_linking == 'off'
86144 run : |
87145 python3 -m pytest python/finufft/test
0 commit comments