diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index eaa80727..297fb701 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -41,8 +41,14 @@ jobs: # This is probably something to do with \ vs / in paths... - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ startsWith(matrix.os, 'windows') }} + - uses: actions/cache@v6 + with: + path: ${{ runner.temp }}/cibw-cache + key: cibw-${{ runner.os }}-${{ hashFiles('scripts/*') }} - name: Build wheels uses: pypa/cibuildwheel@v4.3.5 + env: + CIBW_CACHE_PATH: ${{ runner.temp }}/cibw-cache - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} diff --git a/scripts/cibw_before_all.sh b/scripts/cibw_before_all.sh index 5c93b410..a4beab74 100644 --- a/scripts/cibw_before_all.sh +++ b/scripts/cibw_before_all.sh @@ -61,6 +61,12 @@ done set -o xtrace +if [ -n "$CIBW_CACHE_PATH" ] && [ -d $CIBW_CACHE_PATH/.local ] +then + cp -av $CIBW_CACHE_PATH/.local $PREFIX + exit 0 +fi + if [ $SKIP_GMP = "no" ] then GMP_VERSION=6.3.0 @@ -136,3 +142,9 @@ if [ "$OSTYPE" = "cygwin" ] then genlib libzz-0.dll fi + +if [ -n "$CIBW_CACHE_PATH" ] && [ ! -d $CIBW_CACHE_PATH/.local ] +then + rm -rf $CIBW_CACHE_PATH/.local + cp -av $PREFIX $CIBW_CACHE_PATH/.local +fi