Skip to content

Commit

Permalink
ci: build wheels locally when running single platform so as to use cc…
Browse files Browse the repository at this point in the history
…ache
  • Loading branch information
Zhaoyilunnn committed Dec 5, 2024
1 parent c023bbb commit e49b10e
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ jobs:
matrix:
os-arch: [manylinux_x86_64]
python-version: ['3.10']
cibw-python: [cp38, cp39, cp310, cp311]
include:
- os-arch: manylinux_x86_64
os: ubuntu-20.04
runs-on: ${{ matrix.os }}

env:
CIBW_BUILD: ${{ matrix.cibw-python }}-${{ matrix.os-arch }}
PYTHON: ${{ matrix.python-version }}
TWINE_USERNAME: __token__

Expand All @@ -44,7 +42,7 @@ jobs:
id: ccache-cache
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.h') }}
key: ccache-${{ runner.os }}-${{ hashFiles('src/**/*.hpp', 'src/**/*.cpp', 'src/**/*.h', 'src/**/*.cuh') }}
restore-keys: |
ccache-${{ runner.os }}-
Expand All @@ -64,11 +62,11 @@ jobs:

# Install Python dependencies
- name: Install Python dependencies
run: python -m pip install pybind11 cibuildwheel scikit-build twine pytest
run: python -m pip install pybind11 scikit-build build twine pytest

# Build wheels
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
- name: Build wheels using python build
run: python -m build --wheel
shell: bash

# Display ccache statistics
Expand All @@ -86,8 +84,9 @@ jobs:
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}

build_wheels:
name: Build python wheels

all_platform_build_and_publish_package:
name: Build python wheels on all platforms
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
strategy:
matrix:
Expand All @@ -113,20 +112,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# Install dependencies including ccache
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ccache

# Restore ccache cache
- uses: actions/cache@v3
id: ccache-cache
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.h') }}
restore-keys: |
ccache-${{ runner.os }}-

# Set up Python
- uses: actions/setup-python@v3
Expand All @@ -151,9 +137,6 @@ jobs:
run: python -m cibuildwheel --output-dir dist
shell: bash

# Display ccache statistics
- name: Display ccache statistics
run: ccache -s

# Publish package
- name: Publish package
Expand Down

0 comments on commit e49b10e

Please sign in to comment.