-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Will
committed
Oct 13, 2024
1 parent
83e0303
commit af5bf41
Showing
7 changed files
with
210 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,16 @@ name: Dist | |
on: | ||
push: | ||
branches: [ release, next ] | ||
pull_request: | ||
branches: [ release, next ] | ||
|
||
# Notes on the Wheels: | ||
# macos-13 is an intel runner, which cibw wants for x86 builds... But intel mac is busted. | ||
# https://github.com/e-dant/watcher/actions/runs/9929111640/job/27426247416#step:3:293 | ||
# We don't support Windows (but we want to) because meson-python doesn't allow us | ||
# to install shared libraries in wheels for Windows. More info and whatnot here: | ||
# https://github.com/mesonbuild/meson-python/discussions/629 | ||
# Other refs, for the action file: | ||
# - https://cibuildwheel.pypa.io/en/stable/setup | ||
# - https://github.com/scikit-image/scikit-image/blob/main/.github/workflows/wheels_recipe.yml | ||
jobs: | ||
linux-dist: | ||
runs-on: ${{matrix.os}} | ||
|
@@ -79,3 +86,110 @@ jobs: | |
with: | ||
name: ${{matrix.triple}}.tar.sha256sum | ||
path: out/${{matrix.triple}}.tar.sha256sum | ||
wheels-linux: | ||
name: (x86_64|aarch64)-unknown-linux-(gnu|musl) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
- uses: pypa/[email protected] | ||
with: | ||
package-dir: . | ||
output-dir: wheelhouse | ||
config-file: pyproject.toml | ||
- run: python3 tool/shasum.py wheelhouse show | ||
- run: python3 tool/shasum.py wheelhouse mk | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-linux | ||
path: wheelhouse/* | ||
wheels-apple: | ||
name: aarch64-apple-darwin | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pypa/[email protected] | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: 11 | ||
with: | ||
package-dir: . | ||
output-dir: wheelhouse | ||
config-file: pyproject.toml | ||
- run: python3 tool/shasum.py wheelhouse show | ||
- run: python3 tool/shasum.py wheelhouse mk | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-apple | ||
path: wheelhouse/* | ||
create-gh-release: | ||
name: Create GitHub Release | ||
if: ${{ github.ref == 'refs/heads/release' }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- linux-dist | ||
- apple-dist | ||
- windows-dist | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
tool/fetch-release-artifacts --no-zip | ||
gh release create "$(cat .version)" --notes "$(tool/show-changelog-for-version)" | ||
gh release upload "$(cat .version)" out/dist/* | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Ref: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows | ||
publish-wheels-testpypi: | ||
name: Publish Wheels (TestPyPI) | ||
runs-on: ubuntu-latest | ||
needs: | ||
- wheels-apple | ||
- wheels-linux | ||
environment: | ||
name: dist | ||
url: https://test.pypi.org/p/wtr-watcher | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ github.token }} | ||
- run: | | ||
tool/fetch-release-artifacts --no-zip | ||
mkdir dist | ||
find out/dist -name '*.whl' | while read f | ||
do cp "$f" dist ; echo "$f" | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
publish-wheels-pypi: | ||
name: Publish Wheels | ||
if: ${{ github.ref == 'refs/heads/release' }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- wheels-apple | ||
- wheels-linux | ||
environment: | ||
name: dist | ||
url: https://pypi.org/p/wtr-watcher | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ github.token }} | ||
- run: | | ||
tool/fetch-release-artifacts --no-zip | ||
mkdir dist | ||
find out/dist -name '*.whl' | while read f | ||
do cp "$f" dist ; echo "$f" | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://pypi.org/legacy/ | ||
verbose: true |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: [ "Wheels" ] | ||
branches: [ next ] | ||
types: | ||
- completed | ||
push: | ||
branches: [ next ] | ||
|
||
jobs: | ||
a: | ||
name: a | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo ok | ||
publish-to-testpypi: | ||
name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
needs: | ||
- wheels-apple | ||
- wheels-linux | ||
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/wtr-watcher-runner | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
steps: | ||
- run: | | ||
tool/fetch-release-artifacts --no-zip | ||
mkdir dist | ||
find out/dist -name '*.whl' | while read f | ||
do cp "$f" dist ; echo "$f" | ||
done | ||
- name: Publish distribution 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
default_version=$(cat "$(dirname "$0")/../.version") | ||
usage() { | ||
cat <<EOF | ||
Usage: $0 [version(= $default_version) | --help, -h] | ||
Example: | ||
For a changelog with the following content: | ||
# A doc | ||
## 0.12.1 | ||
text | ||
## 0.12.0 | ||
other text | ||
The command: | ||
$ $0 0.12.1 | ||
Would display: | ||
text | ||
EOF | ||
} | ||
version=${1:-$default_version} | ||
[ "$1" = "--help" -o "$1" = "-h" ] && { usage ; exit 0; } | ||
changelog="$(dirname "$0")/../changelog.md" | ||
awk \ | ||
-v section="## $version" \ | ||
' | ||
$0 ~ section { in_section=1; next } | ||
in_section && /^## / && $0 != section { in_section=0 } | ||
in_section { print }' \ | ||
"$changelog" |