Skip to content

Commit e29005d

Browse files
committed
feat: Separated the workflow for reusability, fixed runner issue
1 parent fda3a22 commit e29005d

File tree

2 files changed

+72
-43
lines changed

2 files changed

+72
-43
lines changed

.github/workflows/generate-index.yml

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -75,51 +75,17 @@ jobs:
7575
# - name: Deploy to GitHub Pages
7676
# id: deploy
7777
# uses: actions/deploy-pages@v4
78+
7879
test:
79-
# needs: deploy
80-
runs-on: ubuntu-24
8180
strategy:
8281
matrix:
8382
python-version: ["3.13"]
8483
wasmer-version: ["v6.1.0-rc.3"]
85-
steps:
86-
- uses: actions/checkout@v5
87-
- name: Set up Python 3.13
88-
uses: actions/setup-python@v5
89-
with:
90-
python-version: ${{ matrix.python-version }}
91-
- name: Setup environment
92-
run: |
93-
python -m venv env
94-
source venv/bin/activate
95-
pip install .
96-
pip install pytest
97-
# Validate that the python tests themselves are valid
98-
- name: Run tests
99-
run: pytest
100-
101-
# Secondly, validate that the tests pass within wasmer as well
102-
- name: Install uv
103-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
104-
- name: Install wasmer
105-
run: curl https://get.wasmer.io -sSfL | sh -s ${{ matrix.wasmer-version }}
106-
- name: Setup project for wasmer
107-
run: |
108-
uv pip compile pyproject.toml \
109-
--python-version=${{ matrix.python-version }} \
110-
--universal \
111-
--extra-index-url https://pythonindex.wasix.org/simple \
112-
--index-url=https://pypi.org/simple \
113-
--emit-index-url \
114-
--only-binary :all: \
115-
-o wasmer-requirements.txt
116-
117-
uvx pip install -r wasmer-requirements.txt \
118-
--python-version=${{ matrix.python-version }} \
119-
--target wasix-site-packages \
120-
--platform wasix_wasm32 \
121-
--only-binary=:all: \
122-
--compile
123-
# Ensure tests pass on wasmer
124-
- name: Run tests (wasmer)
125-
run: wasmer run .
84+
uses: ./.github/workflows/test.yml
85+
with:
86+
python-version: ${{ matrix.python-version }}
87+
wasmer-version: ${{ matrix.wasmer-version }}
88+
# Test primary python index only for now. This
89+
# setup allows for hosting a separate "testing" python
90+
# index down the line (or simply a local one)
91+
python-index: https://pythonindex.wasix.org
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
wasmer-version:
10+
required: true
11+
type: string
12+
python-index:
13+
required: true
14+
type: string
15+
ubuntu-runner:
16+
required: false
17+
type: string
18+
default: "ubuntu-24.04"
19+
20+
jobs:
21+
test:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v5
25+
- name: Set up Python ${{ inputs.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ inputs.python-version }}
29+
- name: Setup environment
30+
run: |
31+
python -m venv env
32+
source venv/bin/activate
33+
pip install .
34+
pip install pytest
35+
# Validate that the python tests themselves are valid
36+
- name: Run tests
37+
run: pytest
38+
39+
# Secondly, validate that the tests pass within wasmer as well
40+
- name: Install uv
41+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
42+
- name: Install wasmer
43+
run: curl https://get.wasmer.io -sSfL | sh -s ${{ inputs.wasmer-version }}
44+
- name: Setup project for wasmer
45+
run: |
46+
uv pip compile pyproject.toml \
47+
--python-version=${{ inputs.python-version }} \
48+
--universal \
49+
--extra-index-url ${{ inputs.python-index }}/simple \
50+
--index-url=https://pypi.org/simple \
51+
--emit-index-url \
52+
--only-binary :all: \
53+
-o wasmer-requirements.txt
54+
55+
uvx pip install -r wasmer-requirements.txt \
56+
--python-version=${{ inputs.python-version }} \
57+
--target wasix-site-packages \
58+
--platform wasix_wasm32 \
59+
--only-binary=:all: \
60+
--compile
61+
# Ensure tests pass on wasmer
62+
- name: Run tests (wasmer)
63+
run: wasmer run .

0 commit comments

Comments
 (0)