CI #2664
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: [main] | |
tags-ignore: [dev] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '0 0 * * *' # run at 00:00 UTC | |
# Cancel any in-flight jobs for the same PR/branch so there's only one active | |
# at a time | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.x', '3.9'] | |
exclude: | |
# Looks like pypy on Windows is 32-bit, so don't test it since we | |
# only work with 64-bit builds | |
- os: windows-latest | |
python-version: pypy3 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Tests are flaky on Windows. It's something to do with generating modules | |
# on-the-go in the component codegen tests. I have no idea how to fix it. | |
# This is a last-ditch attempt to get things working. | |
- run: pytest --setup-only | |
continue-on-error: true | |
- run: pytest | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch all history so the git-commit-length-appended-to-version for | |
# publishes to `test.pypi.org` works. (see `git` command in `setup.py`) | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- run: pip install build | |
# If this is a tagged build use real version numbers | |
- run: echo "PROD=true" >> $GITHUB_ENV | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
- name: Build sdist (source distribution) | |
run: | | |
git clean -fdx wasmtime build | |
python -m build --sdist | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=manylinux1-x86_64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=manylinux2014_aarch64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=macosx-10-13-x86_64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=macosx-11-0-arm64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=win-amd64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=win-arm64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=musllinux_1_2_x86_64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=android_26_x86_64 | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--build-option=--plat-name -C=--build-option=android_26_arm64_v8a | |
# Build an "any" wheel with: | |
# | |
# * MinGW | |
# | |
# because at this time I don't know what the `--plat-name` tags supported on | |
# PyPI are for these platforms. Our hope is that any platform not matching | |
# the above `--plat-name` arguments will install this `any` wheel instead, | |
# and then when the wheel runs it'll dynamically select from the available | |
# shared libraries. | |
- run: | | |
git clean -fdx wasmtime build | |
python -m build --wheel -C=--wasmtime-py-mingw-any | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dists | |
path: dist | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- run: pip install pdoc3 | |
- run: pdoc --html wasmtime | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: generated-docs | |
path: html/wasmtime | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- run: coverage run -m pytest | |
- run: coverage html | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: htmlcov | |
upload_docs: | |
needs: [coverage, docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
path: generated-docs/coverage | |
- uses: actions/download-artifact@v4 | |
with: | |
name: generated-docs | |
path: generated-docs | |
- run: find . | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: actions/configure-pages@v5 | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: generated-docs | |
upload_dists: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch all history so the git-commit-length-appended-to-version for | |
# publishes to `test.pypi.org` works. (see `git` command in `setup.py`) | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dists | |
path: dist | |
- run: find . | |
- name: Publish distribution 📦 to Test PyPI | |
if: github.event_name == 'push' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
deploy: | |
name: Deploy gh-pages | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: upload_docs | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v4 |