-
Notifications
You must be signed in to change notification settings - Fork 37
71 lines (60 loc) · 3.23 KB
/
Copy pathpython-tests.yml
File metadata and controls
71 lines (60 loc) · 3.23 KB
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
# Runs Swift's Python test suite (tests/) and the JS unit tests
# (src/swift/public/js/*.test.js) on every push/PR -- previously nothing
# in CI ever ran either; only src/swift/public/**'s vendored-asset check
# existed (see vendor-check.yml).
name: Python tests
on:
push:
branches: [main, future]
pull_request:
branches: [main, future]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build-time dependencies
# roboticstoolbox-python's own setup.py fails inside pip's default
# isolated build environment (ModuleNotFoundError: No module named
# 'pip' -- a known class of issue with legacy setup.py's that
# import pip internally, which an isolated build env doesn't
# guarantee). --no-build-isolation below runs builds against the
# ambient environment instead, which needs numpy (swift-sim's own
# C extension, phys.cpp, imports it at build time) and
# setuptools/wheel present upfront since nothing will install them
# into an isolated env for us anymore.
run: pip install numpy setuptools wheel
- name: Install roboticstoolbox-python and dev/test tools
# tests/ exercises Robot.fkine_geometry(q) -- merged into
# roboticstoolbox-python's main (the feat/fkine-geometry branch it
# originally landed on is now redundant) but not yet released to
# PyPI (swift/roboticstoolbox/spatialgeometry are developed together
# across git branches, ahead of what's actually released -- see
# jhavl/swift#88). Installing from main directly, same idea as
# installing spatialgeometry itself from source below.
run: pip install "git+https://github.com/petercorke/robotics-toolbox-python.git@main" websockets pytest pytest-cov black flake8 pyyaml
- name: Install spatialgeometry from its own main branch
# main renamed Path -> Polyline (jhavl/spatialgeometry#42, merged
# 2026-08-09) but that hasn't been cut into a PyPI release yet --
# PyPI's latest (1.3.0) predates the rename and tests/ constructs
# sg.Polyline(...) directly, so the plain PyPI spatialgeometry that
# roboticstoolbox-python pulled in above fails with AttributeError.
# A separate --force-reinstall --no-deps step (rather than listing
# this alongside roboticstoolbox-python above) sidesteps a pip
# resolver conflict: roboticstoolbox-python's own metadata pins
# spatialgeometry==1.3.0 exactly, which collides with requesting
# the git version under that same version string. Switch this back
# to a plain PyPI pin once a release containing the rename ships.
run: pip install --force-reinstall --no-deps "git+https://github.com/jhavl/spatialgeometry.git@main"
- name: Install swift-sim itself (editable, no dependency re-resolution)
run: pip install --no-build-isolation --no-deps -e .
- name: Run Python tests
run: pytest tests/ -v
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Run JS unit tests
run: node --test src/swift/public/js/*.test.js