-
Notifications
You must be signed in to change notification settings - Fork 8
146 lines (133 loc) · 6.24 KB
/
Copy pathtests.yml
File metadata and controls
146 lines (133 loc) · 6.24 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: tests
on:
workflow_dispatch:
# Scope push to main only — PR branches are covered by pull_request, so this
# avoids a redundant second run (and the "re-ran one, the twin still red" trap)
# on every push to a PR branch.
push:
branches: [main]
pull_request:
jobs:
lint:
name: Lint (pre-commit)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
# ruckig 0.17.3 sdist doesn't build under scikit-build-core 1.0;
# pre-install the fixed commit until a release lands (pantor/ruckig#262).
pip install "ruckig @ git+https://github.com/pantor/ruckig@2249d57ffaa19ecdadeaab62daf97857813629ff"
pip install -e ".[dev]"
# Override the pinned waldoctl with the matching feature branch if one
# exists, AFTER ".[dev]" (and with --force-reinstall) so the pinned tag
# in pyproject can't clobber it. Deps are kept (no --no-deps): the
# refactored waldoctl imports nicegui, which parol6 doesn't otherwise
# install. Skipped on main so main CI exercises the released pin.
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
if [ "$BRANCH" != "main" ] && git ls-remote --heads https://github.com/Jepson2k/waldoctl.git "$BRANCH" 2>/dev/null | grep -q .; then
pip install --force-reinstall "waldoctl @ git+https://github.com/Jepson2k/waldoctl.git@${BRANCH}"
fi
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
test:
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11', '3.12', '3.13', '3.14']
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
- name: Detect matching pinokin branch
id: pinokin
shell: bash
run: |
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
if git ls-remote --heads https://github.com/Jepson2k/pinokin.git "$BRANCH" 2>/dev/null | grep -q .; then
echo "matching=true" >> "$GITHUB_OUTPUT"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
else
echo "matching=false" >> "$GITHUB_OUTPUT"
fi
# ----------------------------------------------------------------------
# Path A: matching pinokin branch -> conda env (provides libpinocchio +
# libcoal headers/libs) so pinokin can be built from source. We install
# PAROL6 first (which pulls in the pinned pinokin v0.1.6 wheel) and
# then override pinokin with the source-built wheel from the matching
# branch. This is the only way to exercise unreleased pinokin features
# before a release lands.
# ----------------------------------------------------------------------
- name: Setup Miniforge (matching pinokin branch)
if: steps.pinokin.outputs.matching == 'true'
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
conda-remove-defaults: true
activate-environment: parol6-test
- name: Clone matching pinokin branch
if: steps.pinokin.outputs.matching == 'true'
run: |
git clone --depth=1 --branch="${{ steps.pinokin.outputs.branch }}" https://github.com/Jepson2k/pinokin.git pinokin-src
conda env update -n parol6-test -f pinokin-src/environment.yml
# ----------------------------------------------------------------------
# Path B: no matching pinokin branch -> plain pip with the pinned
# release wheel. Anything in PAROL6 that requires a newer pinokin
# feature will fail loudly here (intended).
# ----------------------------------------------------------------------
- name: Setup Python (pinned pinokin)
if: steps.pinokin.outputs.matching != 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: Install package
run: |
python -m pip install --upgrade pip
# ruckig 0.17.3 sdist doesn't build under scikit-build-core 1.0;
# pre-install the fixed commit until a release lands (pantor/ruckig#262).
pip install "ruckig @ git+https://github.com/pantor/ruckig@2249d57ffaa19ecdadeaab62daf97857813629ff"
pip install -e ".[dev]" pytest-timeout
# Override the pinned waldoctl with the matching feature branch if one
# exists, AFTER ".[dev]" (and with --force-reinstall) so the pinned tag
# in pyproject can't clobber it. Deps are kept (no --no-deps): the
# refactored waldoctl imports nicegui, which parol6 doesn't otherwise
# install. Skipped on main so main CI exercises the released pin.
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
if [ "$BRANCH" != "main" ] && git ls-remote --heads https://github.com/Jepson2k/waldoctl.git "$BRANCH" 2>/dev/null | grep -q .; then
pip install --force-reinstall "waldoctl @ git+https://github.com/Jepson2k/waldoctl.git@${BRANCH}"
fi
# Override the pinned pinokin v0.1.6 wheel with the matching-branch
# source build. --force-reinstall + --no-deps swaps just pinokin
# without disturbing other resolved dependencies.
- name: Override pinokin with matching-branch source build
if: steps.pinokin.outputs.matching == 'true'
run: |
cd pinokin-src
pip install . --no-build-isolation --force-reinstall --no-deps
python -c "from pinokin import CollisionChecker; print('CollisionChecker available')"
- name: Show environment
run: |
python -V
pip list
- name: Run tests
env:
PYTHONUNBUFFERED: '1'
PYTHONUTF8: '1'
run: |
pytest