allow ci to build during PRs #38
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: [opened, reopened, synchronize] | |
jobs: | |
install_and_test: | |
name: Install project and test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13.0-beta.1" | |
- name: "Install project on ${{ matrix.os }}" | |
run: | | |
pip install . | |
- name: Run tests on ${{ matrix.os }} | |
run: | | |
python tests/test_audioop.py | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: [install_and_test] | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.18.1 | |
env: | |
CIBW_BUILD: "cp313-*" | |
CIBW_PRERELEASE_PYTHONS: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
name: Publish built wheels to Pypi | |
runs-on: ubuntu-latest | |
environment: release | |
needs: [install_and_test, build_wheels] | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
name: Publish to PyPI |