From acee4db87926b9992d779e061c67e4860d7f16a9 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 20 Sep 2024 15:49:18 +0200 Subject: [PATCH] update (simplify) cd.yml --- .github/workflows/cd.yml | 130 +++++++++++++-------------------------- 1 file changed, 42 insertions(+), 88 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index dac18a16..01e5c2cd 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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