-
Notifications
You must be signed in to change notification settings - Fork 1
feat(QA-200): Automated pythonindex package tests #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
baalimago
wants to merge
33
commits into
main
Choose a base branch
from
qa-209-convert-build-scripts-into-a-python-test-project
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5635c1b
feat: Setup local testing with pytest
baalimago 26265fb
feat: Added support for running tests in wasmer runtime
baalimago a943e0c
docs: Changed back formatting to not joink git blame
baalimago f22c676
docs: Added final step to run tests in wasmer
baalimago 948d8cd
feat(debug): Added tests to pipeline as final step
baalimago fda3a22
revertme: Removed path requirement
baalimago e29005d
feat: Separated the workflow for reusability, fixed runner issue
baalimago 79b03a3
fix: Correct path to workflow
baalimago 9369961
tweak: Removed pyenv, shouldnt be needed
baalimago a13a800
fix: Install zbar since tests didnt want to pass without it
baalimago ecba365
feat: Ghetto-pytest refactor (aka compilation-station)
baalimago 96e26b6
tweaks: Inject psql server details as env vars, spelling
baalimago 2ea54f2
tweaks: Removed pytest from dependencies
baalimago bcdf4a3
feat: Converted project to be fastapi
baalimago e0107f9
refactor: It now deploys and runs on edge
baalimago 24467a3
feat: Added <api>/check/<test> and added run-all-tests-via-api.py
baalimago 3d89331
feat: Allow resolving IP to specific server on run-all-tests
baalimago 4ee7f70
cleanup: PR comments
baalimago 68ab11b
cleanup: Reset README oopsie overwrite
baalimago 424cfb6
Apply suggestion from @zebreus
baalimago 62348cd
cleanup: Moved new testing system into directory testing
baalimago 250060c
cleanup: Removed try-catch on pysql and mysql tests to fish for linke…
baalimago a83b06f
tweaks: Test pipeline should in theory now work
baalimago 7a4e785
tweaks: ... theory was incorrect, now it should work
baalimago d805739
fix: Paths should now be OK
baalimago e4dab79
fix: Path to wasmer
baalimago 953ffe4
tweak: Fix path for running python tests natively
baalimago 1ed415e
feat: Re-enable contine-on-error for native tests
baalimago fbcfe19
revert: Pipeline now runs only as last step of normal release
baalimago b3ea1a9
tweak: Reset formatting to not joink git blame on merge commit
baalimago b85f988
tweak: Updated "broken filter" in run-tests.sh
baalimago 2bcfe10
feat: Added env var ALLOW_BROKEN to list broken tests
baalimago f889f33
tweaks: Final things while push to prod + compile, tweaked readme
baalimago File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Test Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
required: true | ||
type: string | ||
wasmer-version: | ||
required: true | ||
type: string | ||
python-index: | ||
required: true | ||
type: string | ||
ubuntu-runner: | ||
required: false | ||
type: string | ||
default: "ubuntu-24.04" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v5 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Setup environment | ||
run: | | ||
cd testing | ||
sudo apt-get install libzbar0 | ||
pip install . | ||
# Validate that the python tests themselves are valid | ||
- name: Run tests natively | ||
continue-on-error: true | ||
run: | | ||
cd testing | ||
TEST_DIR=../tests/ python src/run-tests.py | ||
# Secondly, validate that the tests pass within wasmer as well | ||
- name: Install uv | ||
run: curl -LsSf https://astral.sh/uv/install.sh | sh | ||
- name: Install wasmer | ||
run: curl https://get.wasmer.io -sSfL | sh -s ${{ inputs.wasmer-version }} | ||
- name: Setup project for wasmer | ||
run: | | ||
cd testing | ||
uv pip compile pyproject.toml \ | ||
--python-version=${{ inputs.python-version }} \ | ||
--universal \ | ||
--extra-index-url ${{ inputs.python-index }}/simple \ | ||
--index-url=https://pypi.org/simple \ | ||
--emit-index-url \ | ||
--only-binary :all: \ | ||
-o wasmer-requirements.txt | ||
|
||
uvx pip install -r wasmer-requirements.txt \ | ||
--python-version=${{ inputs.python-version }} \ | ||
--target wasix-site-packages \ | ||
--platform wasix_wasm32 \ | ||
--only-binary=:all: \ | ||
--compile | ||
# Ensure tests pass on wasmer | ||
- name: Run tests (wasmer) | ||
run: cd testing && /home/runner/.wasmer/bin/wasmer run . --registry=wasmer.wtf --command-name=test --net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ __pycache__ | |
/pkgs/*.build | ||
/pkgs/*.prepared | ||
/pkgs/*.sysroot | ||
wasix-site-packages | ||
wasmer-requirements.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: build-scripts | ||
app_id: da_nm3IetwU74x2 | ||
owner: wasmer | ||
package: '.' | ||
kind: wasmer.io/App.v0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: wasmer.io/App.v0 | ||
name: build-scripts | ||
owner: lorentz-dev | ||
package: . | ||
app_id: da_2OPIqt7UeOLK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "wasmer-build-scripts" | ||
version = "0.0.0" | ||
description = "Test scaffolding for build-scripts; runs tests via pytest." | ||
readme = "README.md" | ||
requires-python = ">=3.13" | ||
authors = [{ name = "Wasmer contributors" }] | ||
dependencies = [ | ||
"annotated-types", | ||
"brotlicffi", | ||
"certifi", | ||
"cffi", | ||
"charset-normalizer", | ||
"cryptography", | ||
"google-crc32c", | ||
"fastapi>=0.116.1", | ||
"idna", | ||
"jiter", | ||
"lxml", | ||
"MarkupSafe", | ||
"msgpack", | ||
"mysqlclient", | ||
"numpy", | ||
"orjson", | ||
"pandas", | ||
"Pillow", | ||
"protobuf", | ||
"psycopg[binary]", | ||
"pycparser", | ||
"pycryptodome", | ||
"pycryptodomex", | ||
"pydantic>=2", | ||
"PyNaCl", | ||
"pyOpenSSL", | ||
"pypandoc", | ||
"pypng", | ||
"pyzbar", | ||
"qrcode", | ||
"regex", | ||
"requests", | ||
"rpds-py", | ||
"shapely", | ||
"six", | ||
"tiktoken", | ||
"typing-inspection", | ||
"typing_extensions", | ||
"tzdata", | ||
"urllib3", | ||
"uvloop", | ||
"uvicorn>=0.35.0", | ||
"python-dateutil", | ||
"psycopg", | ||
"psycopg_pool", | ||
"pytz", | ||
"PyYAML", | ||
"svgwrite", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
include = [] | ||
exclude = ["*"] | ||
|
||
|
||
[tool.pytest.ini_options] | ||
python_files = ["*-test.py", "*_test.py", "test_*.py"] | ||
addopts = ["-q"] | ||
testpaths = ["tests"] | ||
|
||
[[tool.uv.index]] | ||
# A human-friendly name you pick | ||
name = "wasix" | ||
# The Simple index URL | ||
url = "https://wasix-org.github.io/build-scripts/simple" | ||
# Optional – make this the primary index | ||
default = true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may be able to convert the test script to a PEP 723 script with URL based specifiers. That way we should be able to just
uv run
the tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know what that means or how it would work. These preconditionals are just copy-pasted from what Syrus had in the fastapi template.
I vote for out of scope/future improvement!