Skip to content

Commit

Permalink
update (simplify) cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein committed Sep 20, 2024
1 parent b29e64c commit acee4db
Showing 1 changed file with 42 additions and 88 deletions.
130 changes: 42 additions & 88 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,118 +24,72 @@ on:

jobs:

release-builds:
name: Build wheel for ${{ matrix.platform }} ${{ matrix.arch }}
timeout-minutes: 10
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 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: dist

test-wheels:
name: Test wheel for ${{ matrix.name }}
needs: [build-wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: windows
arch: AMD64
os: windows-latest
testable: true
- platform: windows
arch: ARM64
os: windows-latest
- platform: windows
arch: x86
- name: windows amd64
os: windows-latest
- platform: macos
arch: arm64
- name: macos arm64
os: macos-latest
testable: true
- platform: macos
arch: x86_64
- name: macos x86_64
os: macos-13 # last Intel MacOS
cibw_version: '==2.16' # delocation does not work for later versions
- platform: linux
arch: x86_64
os: ubuntu-latest
testable: true
- platform: linux
arch: aarch64
- name: linux amd64
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: matrix.platform == 'linux' && matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip wheel setuptools twine cibuildwheel${{ matrix.cibw_version}}
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PLATFORM: ${{ matrix.platform }}
CIBW_ARCHS: ${{ matrix.arch }}
- name: Twine check
run: |
twine check dist/*
- name: Test wheel
if: matrix.testable
shell: bash
run: |
rm -rf ./wgpu
filename=$(ls dist/*.whl)
pip install $filename
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: Upload distributions
uses: actions/upload-artifact@v4
with:
path: dist
name: ${{ matrix.platform }}-${{ matrix.arch }}-build


sdist-build:
name: Build sdist
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
fail-fast: false
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 -r dev-requirements.txt
- name: Create source distribution
run: |
python setup.py sdist
- name: Test sdist
- name: Download assets
uses: actions/download-artifact@v4
with:
path: dist
- name: Install and test wheel
shell: bash
run: |
rm -rf ./wgpu
filename=$(ls dist/*.tar.gz)
pip install $filename
# don't run tests, we just want to know if the sdist can be installed
pip install --find-links dist wgpu
pip uninstall 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: Twine check
run: |
twine check dist/*
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
path: dist
name: sdist-build

publish:
name: Publish to Github and Pypi
runs-on: ubuntu-latest
needs: [release-builds, sdist-build]
needs: [builld-wheels, test-wheels]
if: success() && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit acee4db

Please sign in to comment.