Skip to content

CI

CI #2416

Workflow file for this run

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 setuptools wheel
# 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')
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py linux x86_64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name manylinux1-x86_64
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py linux aarch64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py darwin x86_64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name macosx-10-13-x86_64
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py darwin arm64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name macosx-11-0-arm64
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py win32 x86_64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name win-amd64
- run: |
git clean -fdx wasmtime build
python ci/download-wasmtime.py musl x86_64
python ci/build-rust.py
python setup.py bdist_wheel --plat-name musllinux_1_2_x86_64
# 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 ci/download-wasmtime.py win32 x86_64
python ci/build-rust.py
python setup.py bdist_wheel
- uses: actions/upload-artifact@v4
with:
name: wheels
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_wheels:
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: wheels
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