Skip to content

Commit

Permalink
ci: 🎡 fix macOS CI (restore build deps cache)
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Feb 1, 2024
1 parent 68ea9ff commit d84274b
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
env:
PCRE_VERSION: "8.45"

outputs:
build-deps-cache-key: ${{ steps.build-deps-cache-key.outputs.value }}
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -57,6 +59,12 @@ jobs:
/opt/vectorscan
/opt/pcre
- name: Capture build dependencies cache key
if: startsWith(matrix.os, 'macos') && steps.build-deps-macos.outputs.cache-hit != 'true'
id: build-deps-cache-key
run: |
echo "value=${{ startsWith(matrix.os, 'macos') && steps.build-deps-macos.outputs.cache-primary-key || '' }}" >> $GITHUB_OUTPUT
build_wheels:
name: ${{ matrix.python_id }}-${{ matrix.platform_id }} wheel
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -211,7 +219,7 @@ jobs:
- if: ${{ !endsWith(matrix.os, '-arm') }}
uses: pdm-project/setup-pdm@v4
with:
python-version: "${{ matrix.python }}"
python-version: ${{ matrix.python }}
cache: true

# XXX: deadsnakes does not provide Python 3.10 for ubuntu 20.04 (jammy)
Expand All @@ -220,7 +228,7 @@ jobs:
- if: ${{ endsWith(matrix.os, '-arm') && !endsWith(matrix.python_id, '310') }}
uses: deadsnakes/[email protected]
with:
python-version: "${{ matrix.python }}"
python-version: ${{ matrix.python }}

- if: ${{ endsWith(matrix.os, '-arm') }}
name: Install PDM
Expand All @@ -236,6 +244,23 @@ jobs:
run: |
echo "version=$(pdm run semantic-release version --no-commit 2>/dev/null)" >> "$GITHUB_OUTPUT"
- name: Setup macOS environment
if: startsWith(matrix.os, 'macos')
run: |
gid=$(id -g)
uid=$(id -u)
sudo mkdir -p /opt/vectorscan /opt/pcre
sudo chown -R $uid:$gid /opt/vectorscan /opt/pcre
- name: Restore build dependencies cache
if: startsWith(matrix.os, 'macos')
uses: actions/cache/restore@v4
with:
key: ${{ needs.build_environment.outputs.build-deps-cache-key }}
path: |
/opt/vectorscan
/opt/pcre
- name: Restore build artifacts cache
id: cache-wheels
uses: actions/cache/restore@v4
Expand All @@ -247,8 +272,8 @@ jobs:
- name: Build and test wheels
if: steps.cache-wheels.outputs.cache-hit != 'true'
env:
PCRE_VERSION: "${{env.PCRE_VERSION}}"
CIBW_ARCHS_MACOS: "${{ matrix.platform_id == 'macosx_arm64' && 'arm64' || 'x86_64' }}"
PCRE_VERSION: ${{env.PCRE_VERSION}}
CIBW_ARCHS_MACOS: ${{ matrix.platform_id == 'macosx_arm64' && 'arm64' || 'x86_64' }}
CIBW_ARCHS_LINUX: auto aarch64
CIBW_BUILD: ${{ matrix.python_id }}-${{ matrix.platform_id }}
CIBW_BUILD_VERBOSITY: 1
Expand Down

0 comments on commit d84274b

Please sign in to comment.