-
Notifications
You must be signed in to change notification settings - Fork 53
196 lines (183 loc) · 6 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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.8']
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