Skip to content

Commit 948d8cd

Browse files
committed
feat(debug): Added tests to pipeline as final step
Also added stuff so that the pipeline is triggered without deploying, also on this branch so that I can debug the flow
1 parent f22c676 commit 948d8cd

File tree

1 file changed

+100
-51
lines changed

1 file changed

+100
-51
lines changed

.github/workflows/generate-index.yml

Lines changed: 100 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Build and Deploy Python Index to GitHub Pages
33
on:
44
push:
55
branches:
6-
- main # Re-generate index on every change to the default branch
6+
- main # Re-generate index on every change to the default branch
7+
- qa-209-convert-build-scripts-into-a-python-test-project
78
paths:
89
- artifacts/*.whl
910
- generate-index.py
@@ -13,64 +14,112 @@ on:
1314
# Minimal permissions required by the official Pages deployment action
1415
# NOTE: these are REPLACED, not merged, with job-level permissions
1516
permissions:
16-
contents: read # to checkout the repository
17-
pages: write # to deploy to Pages
18-
id-token: write # to verify deployment origin
17+
contents: read # to checkout the repository
18+
pages: write # to deploy to Pages
19+
id-token: write # to verify deployment origin
1920

2021
concurrency:
2122
group: "deploy-pages"
2223
cancel-in-progress: true
2324

2425
jobs:
25-
build:
26-
runs-on: ubuntu-latest
26+
# build:
27+
# runs-on: ubuntu-latest
28+
# steps:
29+
# - name: Checkout source
30+
# uses: actions/checkout@v4
31+
# with:
32+
# lfs: true
33+
# submodules: false
34+
# sparse-checkout: |
35+
# # Only checkout the files needed to generate the index
36+
# artifacts
37+
# generate-index.py
38+
# python-wasix-binaries
39+
# - name: Checkout python-wasix-binaries
40+
# run: |
41+
# git submodule update --init python-wasix-binaries
42+
# # Install a fast Python environment + the `uv` CLI (with cache)
43+
# - name: Setup uv & Python
44+
# uses: astral-sh/setup-uv@v6
45+
# with:
46+
# # Install the runner's system Python (faster than compiling)
47+
# python-version: "3.12"
48+
# enable-cache: true
49+
# # Reuse cache when lockfile or project metadata didn’t change
50+
# cache-dependency-glob: |
51+
# generate-index.py
52+
# - name: Generate static package index
53+
# run: |
54+
# ./generate-index.py
55+
#
56+
# # Upload the "dist" folder produced by the script so it can be
57+
# # deployed by the next job.
58+
# - name: Upload Pages artifact
59+
# uses: actions/upload-pages-artifact@v3
60+
# with:
61+
# path: dist
62+
#
63+
# deploy:
64+
# needs: build
65+
# runs-on: ubuntu-latest
66+
# environment:
67+
# name: github-pages # default Pages environment
68+
# url: ${{ steps.deploy.outputs.page_url }}
69+
# # Job-level permissions must explicitly include the same set
70+
# permissions:
71+
# contents: read
72+
# pages: write
73+
# id-token: write
74+
# steps:
75+
# - name: Deploy to GitHub Pages
76+
# id: deploy
77+
# uses: actions/deploy-pages@v4
78+
test:
79+
# needs: deploy
80+
runs-on: ubuntu-24
81+
strategy:
82+
matrix:
83+
python-version: ["3.13"]
84+
wasmer-version: ["v6.1.0-rc.3"]
2785
steps:
28-
- name: Checkout source
29-
uses: actions/checkout@v4
86+
- uses: actions/checkout@v5
87+
- name: Set up Python 3.13
88+
uses: actions/setup-python@v5
3089
with:
31-
lfs: true
32-
submodules: false
33-
sparse-checkout: |
34-
# Only checkout the files needed to generate the index
35-
artifacts
36-
generate-index.py
37-
python-wasix-binaries
38-
- name: Checkout python-wasix-binaries
90+
python-version: ${{ matrix.python-version }}
91+
- name: Setup environment
3992
run: |
40-
git submodule update --init python-wasix-binaries
41-
# Install a fast Python environment + the `uv` CLI (with cache)
42-
- name: Setup uv & Python
43-
uses: astral-sh/setup-uv@v6
44-
with:
45-
# Install the runner's system Python (faster than compiling)
46-
python-version: "3.12"
47-
enable-cache: true
48-
# Reuse cache when lockfile or project metadata didn’t change
49-
cache-dependency-glob: |
50-
generate-index.py
51-
- name: Generate static package index
52-
run: |
53-
./generate-index.py
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
54100

55-
# Upload the "dist" folder produced by the script so it can be
56-
# deployed by the next job.
57-
- name: Upload Pages artifact
58-
uses: actions/upload-pages-artifact@v3
59-
with:
60-
path: dist
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
61116
62-
deploy:
63-
needs: build
64-
runs-on: ubuntu-latest
65-
environment:
66-
name: github-pages # default Pages environment
67-
url: ${{ steps.deploy.outputs.page_url }}
68-
# Job-level permissions must explicitly include the same set
69-
permissions:
70-
contents: read
71-
pages: write
72-
id-token: write
73-
steps:
74-
- name: Deploy to GitHub Pages
75-
id: deploy
76-
uses: actions/deploy-pages@v4
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 .

0 commit comments

Comments
 (0)