Skip to content

CI

CI #1677

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:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.x']
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@v3
- uses: ./.github/actions/setup
- uses: actions/setup-python@v4
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@v3
- 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
# 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@v3
with:
name: wheels
path: dist
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pip install pdoc3
- run: pdoc --html wasmtime
- uses: actions/upload-artifact@v3
with:
name: generated-docs
path: html/wasmtime
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: coverage run -m pytest
- run: coverage html
- uses: actions/upload-artifact@v3
with:
name: coverage
path: htmlcov
upload_docs:
needs: [coverage, docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: coverage
path: generated-docs/coverage
- uses: actions/download-artifact@v3
with:
name: generated-docs
path: generated-docs
- run: find .
- uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: generated-docs
single-commit: true
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
upload_wheels:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- run: find .
- name: Publish distribution 📦 to Test PyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}