Title: Add WebAssembly build, cockle and terminal deployments, and testing by ianthomas23 · Pull Request #52 · QuantStack/git2cpp · GitHub
Open Graph Title: Add WebAssembly build, cockle and terminal deployments, and testing by ianthomas23 · Pull Request #52 · QuantStack/git2cpp
X Title: Add WebAssembly build, cockle and terminal deployments, and testing by ianthomas23 · Pull Request #52 · QuantStack/git2cpp
Description: This PR adds the ability to create a WebAssembly build of the local git2cpp source code, create cockle and JupyterLite terminal deployments to manually check they work, and test via pytest. Most of it is in a new wasm directory to keep it isolated except for some monkey-patching in the top-level test directory because pytest wants it this way. I've tried to keep the makefile-based workflow as simple as possible. wasm/README.md is the most useful file to read. As an example of the local deployments, the following video shows them working after running: cd wasm micromamba create -f wasm-environment.yml micromamba activate git2cpp-wasm make make serve git2cpp.mp4 Note the video shows the git2cpp package coming from a local directory rather than from prefix.dev. The JupyterLite deployment only differs from the cockle one in that it uses the JupyterLite shared filesystem, which can and has been the source of different behaviour so it is useful to have them both. For the local testing: (git2cpp-wasm) malus:wasm iant$ make test make -C test test # A pytest fixture ensures that `npm run serve` runs for the duration of the tests. cd ../../test && GIT2CPP_TEST_WASM=1 pytest -v -rP test_git.py ============================= test session starts ============================== platform darwin -- Python 3.14.0, pytest-8.4.2, pluggy-1.6.0 -- /Users/iant/micromamba/envs/git2cpp-wasm/bin/python3.14 cachedir: .pytest_cache rootdir: /Users/iant/github/git2cpp configfile: .pytest.ini plugins: anyio-4.11.0, base-url-2.1.0, playwright-0.7.1 collecting ... collected 3 items test_git.py::test_version[chromium--v] PASSED [ 33%] test_git.py::test_error_on_unknown_option[chromium] PASSED [ 66%] test_git.py::test_version[chromium---version] PASSED [100%] ==================================== PASSES ==================================== ============================== 3 passed in 2.24s =============================== This is only testing test_git.py, but I will add more in time. The important difference here is the use of GIT2CPP_TEST_WASM environment variable which enables a different set of test fixtures to the normal pytest run. The wasm build clones the recipe from emscripten-forge/recipes, modifies it to read the source code from the local directory, and builds it. The two deployments and the deployment used in the tests all use the built package. The testing using the pytest-playwright extension with monkey-patching in both python and typescript to send the commands to a cockle Shell in the browser and return the results in a format compatible with subprocess.run. Work to do after this in separate PRs: Build and run wasm tests in CI. I don't think this should run on every PR as there is too much that can go wrong initially, so perhaps just using a github actions workflow_dispatch so that any maintainer can manually run it on any branch as required. Build and deploy in CI. Github pages is the simplest to use but is restricted to a single branch such as main. I need to do more monkey-patching in python and typescript so that we can run more of and eventually all of the test suite in wasm.
Open Graph Description: This PR adds the ability to create a WebAssembly build of the local git2cpp source code, create cockle and JupyterLite terminal deployments to manually check they work, and test via pytest. Most of...
X Description: This PR adds the ability to create a WebAssembly build of the local git2cpp source code, create cockle and JupyterLite terminal deployments to manually check they work, and test via pytest. Most of...
Opengraph URL: https://github.com/QuantStack/git2cpp/pull/52
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cda13332-7458-e3b7-5ab3-ad42d0350f04 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C304:C8498:272EB27:3731438:6970F7E4 |
| html-safe-nonce | 3dd7af2b28abb208fbfda52723c4c065576f9566bdafe9c9a0f49595bde0e302 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzA0OkM4NDk4OjI3MkVCMjc6MzczMTQzODo2OTcwRjdFNCIsInZpc2l0b3JfaWQiOiI0MTg0MzQ1ODM1MzY2NjI1MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3755e974087b86359ac9bb74aab232e8345ec6571d3c147c9f016ba15ce3909e |
| hovercard-subject-tag | pull_request:2939865793 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/QuantStack/git2cpp/pull/52/files |
| twitter:image | https://avatars.githubusercontent.com/u/580326?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/580326?s=400&v=4 |
| og:image:alt | This PR adds the ability to create a WebAssembly build of the local git2cpp source code, create cockle and JupyterLite terminal deployments to manually check they work, and test via pytest. Most of... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1b239ebed690c3053869ff31a3b7597834c25673659d63e7b6fd6a9b5d7853de |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/QuantStack/git2cpp git https://github.com/QuantStack/git2cpp.git |
| octolytics-dimension-user_id | 19627246 |
| octolytics-dimension-user_login | QuantStack |
| octolytics-dimension-repository_id | 988433538 |
| octolytics-dimension-repository_nwo | QuantStack/git2cpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 988433538 |
| octolytics-dimension-repository_network_root_nwo | QuantStack/git2cpp |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | aeacfd55297f3de5395c83f200ac35d1f474115e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width