From a9f2c31dba68380e24463b526cb484a58cdc13ca Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 12:07:11 +0200 Subject: [PATCH 01/10] Refactor and fix cd --- .github/workflows/ci.yml | 191 ++++-------------------------- .github/workflows/screenshots.yml | 10 +- 2 files changed, 28 insertions(+), 173 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c78be07c..3393c4b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: '3.12' - name: Install dev dependencies run: | python -m pip install --upgrade pip @@ -40,11 +40,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -60,11 +60,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -88,11 +88,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: '3.12' - name: Install dev dependencies run: | python -m pip install --upgrade pip @@ -109,11 +109,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.12' - name: Install llvmpipe and lavapipe for offscreen canvas run: | sudo apt-get update -y -qq @@ -137,11 +137,11 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -181,9 +181,9 @@ jobs: os: ubuntu-latest pyversion: 'pypy3.9' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.pyversion }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.pyversion }} - name: Install llvmpipe and lavapipe for offscreen canvas @@ -203,148 +203,3 @@ jobs: - name: Memory tests run: | pytest -v tests_mem - - # The release builds are done for the platforms that we want to build wheels for. - # We build wheels, test them, and then upload the wheel as an artifact. - release-builds: - name: Build wheels on ${{ matrix.os }} - timeout-minutes: 10 - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Install dev dependencies - run: | - python -m pip install --upgrade pip wheel setuptools twine - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 - env: - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 - CIBW_ARCHS_LINUX: x86_64 - CIBW_SKIP: cp39-musllinux_x86_64 - with: - output-dir: dist - - name: Twine check - run: | - twine check dist/* - - name: Upload distributions - uses: actions/upload-artifact@v2 - with: - path: dist - name: dist - - # Thees release builds uses QEMU so that we can build wheels for arm64. - # We build wheels and upload the wheel as an artifact, but we don't test them here. - qemu-release-builds: - name: Build wheels on ubuntu-latest with QEMU - timeout-minutes: 10 - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 - env: - CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 - CIBW_ARCHS_LINUX: aarch64 - CIBW_SKIP: cp39-musllinux_aarch64 - with: - output-dir: dist - - name: Upload distributions - uses: actions/upload-artifact@v2 - with: - path: dist - name: dist - - sdist-build: - name: Build sdist - timeout-minutes: 5 - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - 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 - shell: bash - run: | - rm -rf ./wgpu - pushd $HOME - pip install $GITHUB_WORKSPACE/dist/*.tar.gz - popd - # don't run tests, we just want to know if the sdist can be installed - pip uninstall -y wgpu - git reset --hard HEAD - - name: Twine check - run: | - twine check dist/* - - name: Upload distributions - uses: actions/upload-artifact@v2 - with: - path: dist - name: dist - - publish: - name: Publish to Github and Pypi - runs-on: ubuntu-latest - needs: [test-builds, release-builds, qemu-release-builds, sdist-build] - if: success() && startsWith(github.ref, 'refs/tags/v') - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Download assets - uses: actions/download-artifact@v4.1.7 - with: - name: dist - - name: Get version from git ref - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Create GH release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.get_version.outputs.VERSION }} - release_name: Release ${{ steps.get_version.outputs.VERSION }} - 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: Upload release assets - # Move back to official action after fix https://github.com/actions/upload-release-asset/issues/4 - uses: AButler/upload-release-assets@v2.0 - with: - release-tag: ${{ steps.get_version.outputs.VERSION }} - files: 'dist/*.tar.gz;dist/*.whl' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 276d53bd..bf32d297 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -12,11 +12,11 @@ jobs: timeout-minutes: 10 runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.12' - name: Install llvmpipe and lavapipe for offscreen canvas run: | sudo apt-get update -y -qq @@ -32,7 +32,7 @@ jobs: - name: Regenerate screenshots run: | pytest -v --regenerate-screenshots -k test_examples_screenshots examples - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: screenshots From ea73a9ff73a8094f4e2ab0ad0ce47ff369c8a6b4 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 12:12:51 +0200 Subject: [PATCH 02/10] add cd --- .github/workflows/cd.yml | 156 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..d1026658 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,156 @@ +name: CD + +on: + workflow_dispatch: + push: + tags: + - 'v*' + pull_request: + branches: + - main + +jobs: + + # The release builds are done for the platforms that we want to build wheels for. + # We build wheels, test them, and then upload the wheel as an artifact. + release-builds: + name: Build wheels on ${{ matrix.os }} + timeout-minutes: 10 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-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 wheel setuptools twine + - name: Build wheels + uses: pypa/cibuildwheel@v2.20 + env: + CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 + CIBW_ARCHS_LINUX: x86_64 + CIBW_SKIP: cp39-musllinux_x86_64 + with: + output-dir: dist + - name: Twine check + run: | + twine check dist/* + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + path: dist + name: dist + + # These release builds uses QEMU so that we can build wheels for arm64. + # We build wheels and upload the wheel as an artifact, but we don't test them here. + qemu-release-builds: + name: Build wheels on ubuntu-latest with QEMU + timeout-minutes: 10 + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - name: Build wheels + uses: pypa/cibuildwheel@v2.20 + env: + CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 + CIBW_ARCHS_LINUX: aarch64 + CIBW_SKIP: cp39-musllinux_aarch64 + with: + output-dir: dist + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + path: dist + name: dist + + 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 + shell: bash + run: | + rm -rf ./wgpu + pushd $HOME + pip install $GITHUB_WORKSPACE/dist/*.tar.gz + popd + # don't run tests, we just want to know if the sdist can be installed + 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: dist + + publish: + name: Publish to Github and Pypi + runs-on: ubuntu-latest + needs: [release-builds, qemu-release-builds, sdist-build] + 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: + name: dist + - name: Get version from git ref + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - name: Create GH release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + 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: Upload release assets + uses: softprops/action-gh-release@v2 + with: + files: 'dist/*.tar.gz;dist/*.whl' + tag_name: ${{ steps.get_version.outputs.VERSION }} + token: ${{ secrets.GITHUB_TOKEN }} + # - name: Publish to PyPI + # uses: pypa/gh-action-pypi-publish@v1 + # with: + # user: __token__ + # password: ${{ secrets.PYPI_PASSWORD }} From 908989874411b6403187138f576762da5e20e69e Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 12:35:47 +0200 Subject: [PATCH 03/10] tweak --- .github/workflows/cd.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d1026658..2d708b9f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -45,7 +45,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: dist - name: dist + name: ${{ matrix.os }}-build # These release builds uses QEMU so that we can build wheels for arm64. # We build wheels and upload the wheel as an artifact, but we don't test them here. @@ -73,7 +73,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: dist - name: dist + name: qemu-build sdist-build: name: Build sdist @@ -111,7 +111,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: dist - name: dist + name: sdist-build publish: name: Publish to Github and Pypi @@ -131,24 +131,18 @@ jobs: - name: Get version from git ref id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Create GH release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Release Assets + uses: softprops/action-gh-release@v2 with: + files: 'dist/*.tar.gz;dist/*.whl' tag_name: ${{ steps.get_version.outputs.VERSION }} - release_name: Release ${{ steps.get_version.outputs.VERSION }} + name: ${{ steps.get_version.outputs.VERSION }} + token: ${{ secrets.GITHUB_TOKEN }} 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: Upload release assets - uses: softprops/action-gh-release@v2 - with: - files: 'dist/*.tar.gz;dist/*.whl' - tag_name: ${{ steps.get_version.outputs.VERSION }} - token: ${{ secrets.GITHUB_TOKEN }} # - name: Publish to PyPI # uses: pypa/gh-action-pypi-publish@v1 # with: From 843d9236cdb3dbe8a8487f2f73cbcab57bdd256b Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 12:48:54 +0200 Subject: [PATCH 04/10] mmm --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2d708b9f..de7533d5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,13 +20,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-13, macos-14] steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.9' - name: Install dev dependencies run: | python -m pip install --upgrade pip wheel setuptools twine From 1ff1571c34fb60901a99eb68c4fb5ea0029346a2 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 12:53:40 +0200 Subject: [PATCH 05/10] try older version --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index de7533d5..eed35a83 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -31,7 +31,7 @@ jobs: run: | python -m pip install --upgrade pip wheel setuptools twine - name: Build wheels - uses: pypa/cibuildwheel@v2.20 + uses: pypa/cibuildwheel@v2.16 env: CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 CIBW_ARCHS_LINUX: x86_64 From f83a6e49ebf003cfe7830ef3460fd40eff14bef7 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 13:09:52 +0200 Subject: [PATCH 06/10] fix --- .github/workflows/cd.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index eed35a83..1638f6f9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -31,6 +31,7 @@ jobs: run: | python -m pip install --upgrade pip wheel setuptools twine - name: Build wheels + # Use v2.16, v2.20 fails the osx builds uses: pypa/cibuildwheel@v2.16 env: CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 @@ -127,7 +128,7 @@ jobs: - name: Download assets uses: actions/download-artifact@v4 with: - name: dist + path: dist - name: Get version from git ref id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} From 3923e5300f34f0dc122b9065655615950723c9f2 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 13:25:03 +0200 Subject: [PATCH 07/10] fix artifacts and set-output --- .github/workflows/cd.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1638f6f9..0d8ca4d9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -129,20 +129,19 @@ jobs: uses: actions/download-artifact@v4 with: path: dist - - name: Get version from git ref - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - 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: - files: 'dist/*.tar.gz;dist/*.whl' - tag_name: ${{ steps.get_version.outputs.VERSION }} - name: ${{ steps.get_version.outputs.VERSION }} + files: 'dist/**/*.tar.gz;dist/**/*.whl' + tag_name: ${{ env.WGPU_PY_VERSION }} + name: ${{ env.WGPU_PY_VERSION }} token: ${{ secrets.GITHUB_TOKEN }} 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 + draft: true prerelease: false # - name: Publish to PyPI # uses: pypa/gh-action-pypi-publish@v1 From 406df5d9b05e34ec5ef682ea6df211d439294d0a Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 16:35:23 +0200 Subject: [PATCH 08/10] try --- .github/workflows/cd.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0d8ca4d9..eb63bcd6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -134,10 +134,12 @@ jobs: - name: Upload Release Assets uses: softprops/action-gh-release@v2 with: - files: 'dist/**/*.tar.gz;dist/**/*.whl' 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. From cac3a1506b994d79b65dad925c927e4bcce00318 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 16:51:12 +0200 Subject: [PATCH 09/10] mac-latest also builds x86 --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index eb63bcd6..b2792bcb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 - name: Set up Python From f341a5f9aab9d03945ae4df52a999ef734fb7960 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 5 Sep 2024 17:00:17 +0200 Subject: [PATCH 10/10] turn it on --- .github/workflows/cd.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b2792bcb..e9ac5b3f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -143,10 +143,10 @@ jobs: body: | Autogenerated binary wheels that include wgpu-native. See [the changelog](https://github.com/pygfx/wgpu-py/blob/main/CHANGELOG.md) for details. - draft: true + draft: false prerelease: false - # - name: Publish to PyPI - # uses: pypa/gh-action-pypi-publish@v1 - # with: - # user: __token__ - # password: ${{ secrets.PYPI_PASSWORD }} + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }}