Clean up async code #306
Workflow file for this run
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
# Github Actions script to produce binary wheels. | |
# | |
# * One build to create all wheels (cross-platform). | |
# * One build (with matrix) test the wheels on a selection of platforms. | |
# * One build to publish the wheels on GitHub and Pypi. | |
name: CD | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-wheels: | |
name: Build all wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dev dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U -e .[build] | |
- name: Build wheels (and sdist) | |
run: python tools/build_all_wheels.py | |
- name: Twine check | |
run: | | |
twine check dist/* | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: all_wheels | |
test-wheels: | |
name: Test wheel for ${{ matrix.name }} | |
needs: [build-wheels] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: windows amd64 | |
os: windows-latest | |
- name: macos arm64 | |
os: macos-latest | |
- name: macos x86_64 | |
os: macos-13 # last Intel MacOS | |
- name: linux amd64 | |
os: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- name: Flatten dist dir | |
shell: bash | |
run: | | |
find dist -mindepth 2 -type f -exec mv -f '{}' dist/ ';' | |
rm -rf dist/*/ | |
- name: Install and test wheel | |
shell: bash | |
run: | | |
rm -rf ./wgpu | |
# Install 'normally' to install deps, then force the install from dist-folder and nothing else | |
pip install --find-links dist wgpu | |
pip install --force-reinstall --no-deps --no-index --find-links dist wgpu | |
pushd $HOME | |
python -c 'import wgpu.backends.wgpu_native; print(wgpu.backends.wgpu_native._ffi.lib_path)' | |
popd | |
pip uninstall -y wgpu | |
git reset --hard HEAD | |
- name: Install from sdist | |
shell: bash | |
run: | | |
rm -rf ./wgpu | |
rm -rf ./dist/*.whl | |
# Install sdist, but no test, because there is no wgpu-native lib now. | |
filename=$(ls dist/*.tar.gz) | |
pip install $filename | |
python -c "import wgpu; print(wgpu.__version__)" | |
pip uninstall -y wgpu | |
git reset --hard HEAD | |
publish: | |
name: Publish to Github and Pypi | |
runs-on: ubuntu-latest | |
needs: [build-wheels, test-wheels] | |
if: success() && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- name: Flatten dist dir | |
run: | | |
find dist -mindepth 2 -type f -exec mv -f '{}' dist/ ';' | |
rm -rf dist/*/ | |
- name: Set version from git ref | |
run: echo "WGPU_PY_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.WGPU_PY_VERSION }} | |
name: ${{ env.WGPU_PY_VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
dist/*.tar.gz | |
dist/*.whl | |
body: | | |
Autogenerated binary wheels that include wgpu-native. | |
See [the changelog](https://github.com/pygfx/wgpu-py/blob/main/CHANGELOG.md) for details. | |
draft: false | |
prerelease: false | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |