Skip to content

Commit aaeae8d

Browse files
Test latest Python on Windows/Linux; all for macOS
Update GitHub Actions to build and test only the latest supported Python on Windows and Linux. On macOS, test all supported Python versions.
1 parent 74a35ec commit aaeae8d

6 files changed

Lines changed: 60 additions & 128 deletions

File tree

.github/actions/build/action.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@ inputs:
66
python-version:
77
description: Python version
88
required: true
9-
build-mode:
10-
required: false
11-
default: conan
129
conan-args:
1310
required: false
1411
default: ""
15-
extra-apt:
16-
required: false
17-
default: ""
1812
is-canary:
1913
description: If a canary build is being performed.
2014
required: false
2115
default: false
22-
install-doc-reqs:
23-
description: If documentation requirements should be installed.
16+
skip-build:
17+
description: Used to do all build related setup, while skipping the actual build
2418
required: false
2519
default: false
2620

@@ -41,7 +35,7 @@ runs:
4135
shell: bash
4236
run: |
4337
sudo apt-get update
44-
sudo apt-get install -y build-essential python3-setuptools python3-tk ${{ inputs.extra-apt }}
38+
sudo apt-get install -y build-essential python3-setuptools python3-tk libgtk2.0
4539
4640
- name: SWIG Install (Linux)
4741
if: runner.os == 'Linux'
@@ -78,10 +72,6 @@ runs:
7872
$newPath = “C:\Program Files\SWIG\swigwin-4.2.1;$oldpath;${{ env.GITHUB_WORKSPACE }}\dist3\Basilisk”
7973
echo "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
8074
81-
- name: Update Python tooling to latest
82-
shell: bash
83-
run: pip install -U pip wheel setuptools
84-
8575
- name: Install requirements
8676
shell: bash
8777
run: |
@@ -91,18 +81,7 @@ runs:
9181
pip install -r requirements.txt -r requirements_dev.txt
9282
fi
9383
94-
- name: Install documentation requirements
95-
if: ${{ inputs.install-doc-reqs == 'true' }}
96-
shell: bash
97-
run: |
98-
if [[ "${{ inputs.is-canary }}" == 'true' ]]; then
99-
pip install -r .github/workflows/requirements_doc.txt
100-
else
101-
pip install -r requirements_doc.txt
102-
fi
103-
10484
- name: Cache Conan
105-
if: ${{ inputs.build-mode == 'conan' }}
10685
uses: actions/cache@v4
10786
with:
10887
path: ${{ env.HOME }}/.conan2
@@ -113,29 +92,21 @@ runs:
11392
conan-${{ runner.os }}-py${{ inputs.python-version }}-
11493
11594
- name: Configure Conan profile
116-
if: ${{ inputs.build-mode == 'conan' }}
11795
shell: bash
11896
run: |
11997
python -m conans.conan profile detect --exist-ok
12098
prof_path="$(python -m conans.conan profile path default)"
121-
12299
grep -q '^\[conf\]' "$prof_path" || printf "\n[conf]\n" >> "$prof_path"
123100
grep -q '^tools.system.package_manager:mode=install$' "$prof_path" || \
124-
printf "tools.system.package_manager:mode=install\n" >> "$prof_path"
101+
printf "tools.system.package_manager:mode=install\n" >> "$prof_path"
125102
grep -q '^tools.system.package_manager:sudo=True$' "$prof_path" || \
126103
printf "tools.system.package_manager:sudo=True\n" >> "$prof_path"
127104
128-
- name: Build Basilisk (Conanfile)
129-
if: ${{ inputs.build-mode == 'conan' }}
105+
- name: Build Basilisk
130106
shell: bash
107+
if: ${{ inputs.skip-build == 'false' }}
131108
env:
132-
CONAN_NON_INTERACTIVE: "1"
133-
run: |
134-
python conanfile.py ${{ inputs.conan-args }}
135-
136-
- name: Build Basilisk (Pip)
137-
if: ${{ inputs.build-mode == 'pip' }}
138-
shell: bash
109+
CONAN_ARGS: ${{ inputs.conan-args }}
139110
run: |
140-
pip install . -v
111+
pip install --no-build-isolation -e . -v
141112
bskLargeData

.github/actions/docs/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ description: Build Sphinx docs
33

44
inputs:
55
html-dir: { required: false, default: "docs/build/html" }
6+
is-canary:
7+
description: If a canary build is being performed.
8+
required: false
9+
default: false
610

711
runs:
812
using: composite
@@ -11,7 +15,11 @@ runs:
1115
shell: bash
1216
run: |
1317
brew install doxygen
14-
pip install -r requirements_doc.txt
18+
if [[ "${{ inputs.is-canary }}" == 'true' ]]; then
19+
pip install -r .github/workflows/requirements_doc.txt
20+
else
21+
pip install -r requirements_doc.txt
22+
fi
1523
- name: Generate doc artifacts
1624
shell: bash
1725
env:

.github/workflows/canary.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: "Canary Build"
22

33
on:
4-
schedule:
5-
- cron: "0 0 * * 0" # Run weekly on Sunday at midnight
64
workflow_dispatch:
75
pull_request:
86
branches:
@@ -37,10 +35,8 @@ jobs:
3735
uses: ./.github/actions/build
3836
with:
3937
python-version: ${{ matrix.python-version }}
40-
build-mode: conan
41-
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True --pyPkgCanary True
38+
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --pyPkgCanary True
4239
is-canary: true
43-
install-doc-reqs: true
4440
- name: Capture final package versions
4541
run: |
4642
pip freeze > final_versions.txt
@@ -49,16 +45,17 @@ jobs:
4945
echo "\n" >> $GITHUB_STEP_SUMMARY
5046
echo "Package version changes:" >> $GITHUB_STEP_SUMMARY
5147
diff -u initial_versions.txt final_versions.txt | grep -E '^[+-]' | grep -v '^+++' | grep -v '^---' >> $GITHUB_STEP_SUMMARY
52-
- name: Run Python Tests
53-
working-directory: src
54-
run: pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
55-
if: ${{ always() }}
48+
# NOTE: The documentation depends on images generated by executing the
49+
# Python tests successfully. As such, the "Build docs" action below
50+
# handles running the Python tests internally
5651
- name: Run C/C++ Tests
5752
working-directory: ./dist3
5853
run: ctest -C Release
5954
if: ${{ always() }}
6055
- name: Build docs
6156
uses: ./.github/actions/docs
57+
with:
58+
is-canary: true
6259
- name: Upload package version logs
6360
if: always()
6461
uses: actions/upload-artifact@v4

.github/workflows/merge.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ jobs:
4848
- name: Checkout code
4949
uses: actions/checkout@v4
5050

51+
# The 'Build wheel' step will perform the actual build. However, we want
52+
# all pre build setup to still be performed
5153
- uses: ./.github/actions/build
5254
with:
5355
python-version: ${{ matrix.python-version }}
54-
build-mode: pip
5556
extra-apt: "cmake"
57+
skip-build: true
5658

5759
- name: Build wheel
5860
run: |
@@ -73,7 +75,6 @@ jobs:
7375
uses: ./.github/actions/build
7476
with:
7577
python-version: 3.13
76-
build-mode: conan
7778
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True
7879
- name: Build docs
7980
uses: ./.github/actions/docs

.github/workflows/pull-request.yml

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13,89 +13,49 @@ jobs:
1313
runs-on: ubuntu-22.04
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-python@v5
17-
with:
18-
python-version: 3.11
19-
- id: file_changes
20-
uses: tj-actions/changed-files@v44
21-
- uses: pre-commit/action@v3.0.1
22-
with:
23-
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files}}
16+
- uses: ./.github/actions/pre-commit
2417

25-
# Perform a Basilisk build with all supported python versions using the
26-
# conanfile install based approach. For the latest python release, enable
27-
# additional conan args.
28-
build-linux-conan:
18+
build-linux:
2919
runs-on: ubuntu-22.04
20+
timeout-minutes: 90
21+
needs: pre-commit
3022
strategy:
3123
fail-fast: false
3224
matrix:
33-
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
34-
include:
35-
- python: 3.13
36-
extra_apt: libgtk2.0
37-
conan_args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
38-
error_for_skips: true
39-
name: Linux (Conanfile, ${{ matrix.python }})
25+
python: ["3.13"]
26+
name: Linux (${{ matrix.python }})
4027
steps:
4128
- uses: actions/checkout@v4
4229
- uses: ./.github/actions/build
4330
with:
4431
python-version: ${{ matrix.python }}
45-
build-mode: conan
46-
extra-apt: ${{ matrix.extra_apt || '' }}
47-
conan-args: ${{ matrix.conan_args || '' }}
32+
conan-args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
4833
- name: Pytest
4934
working-directory: src
5035
run: |
51-
if [ "${{ matrix.error_for_skips || 'false' }}" = "true" ]; then
52-
pip install pytest-error-for-skips
53-
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
54-
else
55-
pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
56-
fi
36+
pip install pytest-error-for-skips
37+
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
5738
- name: CTest
5839
if: ${{ always() }}
5940
working-directory: dist3
6041
run: ctest
6142

62-
# Perform a Basilisk build with all newer supported python versions using the
63-
# pip install based approach.
64-
build-linux-pip:
65-
runs-on: ubuntu-22.04
66-
strategy:
67-
fail-fast: false
68-
matrix:
69-
python: ["3.11", "3.12", "3.13"]
70-
name: Linux (pip, ${{ matrix.python }})
71-
steps:
72-
- uses: actions/checkout@v4
73-
- uses: ./.github/actions/build
74-
with:
75-
python-version: ${{ matrix.python }}
76-
build-mode: pip
77-
- name: Pytest
78-
working-directory: src
79-
run: pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
80-
81-
# Perform a Basilisk build with Python 3.11 using the conanfile install based
82-
# approach.
8343
build-windows:
8444
runs-on: windows-2025
85-
timeout-minutes: 100
45+
timeout-minutes: 90
46+
needs: pre-commit
8647
strategy:
8748
fail-fast: false
8849
matrix:
89-
python: ["3.11"]
90-
name: Windows (Conanfile, ${{ matrix.python }})
50+
python: ["3.13"]
51+
name: Windows (${{ matrix.python }})
9152
env:
9253
MPLBACKEND: agg
9354
steps:
9455
- uses: actions/checkout@v4
9556
- uses: ./.github/actions/build
9657
with:
9758
python-version: ${{ matrix.python }}
98-
build-mode: conan
9959
conan-args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
10060
- name: Pytest
10161
shell: pwsh
@@ -112,42 +72,38 @@ jobs:
11272
ctest
11373
if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) { exit 1 }
11474
115-
# Perform a Basilisk build with modern python versions using the conanfile
116-
# install based approach. For Python 3.11 we perform a no viz build.
11775
build-macos:
11876
runs-on: macos-latest
119-
timeout-minutes: 75
77+
timeout-minutes: 90
78+
needs: pre-commit
12079
strategy:
12180
fail-fast: false
12281
matrix:
123-
python: ["3.11", "3.12", "3.13"]
82+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
83+
pytest_flags:
84+
['-n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v']
85+
# Python 3.8 cannot run all tests.
86+
# TODO: Once Python 3.8 support is dropped, delete this include and exclude and remove 3.8 from the python
87+
# test matrix.
12488
include:
125-
- python: 3.11
126-
conan_args: "--vizInterface False"
127-
- python: 3.12
128-
conan_args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
129-
error_for_skips: true
130-
- python: 3.13
131-
conan_args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
132-
error_for_skips: true
89+
- python: "3.8"
90+
pytest_flags: -n auto -m "not ciSkip" -rs --dist=loadscope -v -p no:pytest_forbid_skips
91+
exclude:
92+
- python: "3.8"
93+
pytest_flags: '-n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v'
13394

134-
name: macOS (Conanfile, ${{ matrix.python }})
95+
name: macOS (${{ matrix.python }})
13596
steps:
13697
- uses: actions/checkout@v4
13798
- uses: ./.github/actions/build
13899
with:
139100
python-version: ${{ matrix.python }}
140-
build-mode: conan
141-
conan-args: ${{ matrix.conan_args }}
101+
conan-args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
142102
- name: Pytest
143103
working-directory: src
144104
run: |
145-
if [ "${{ matrix.error_for_skips || 'false' }}" = "true" ]; then
146-
pip install pytest-error-for-skips
147-
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
148-
else
149-
pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
150-
fi
105+
pip install pytest-error-for-skips
106+
pytest ${{ matrix.pytest_flags }}
151107
- name: CTest
152108
if: ${{ always() }}
153109
working-directory: dist3
@@ -162,8 +118,6 @@ jobs:
162118
uses: ./.github/actions/build
163119
with:
164120
python-version: 3.13
165-
build-mode: conan
166121
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True
167-
install-doc-reqs: true
168122
- name: Build docs
169123
uses: ./.github/actions/docs

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ def get_source_files(self) -> list[str]:
9191
def run(self) -> None:
9292
for ext in self.conan_extensions:
9393
if self.editable_mode:
94-
# TODO: Add support for installing in editable mode. For now, we
95-
# assume that it has already been built (e.g. by `conanfile.py`)
96-
pass
94+
# TODO: Add support for installing in editable mode.
95+
built = any(Path(ext.build_dir).glob("Basilisk*"))
96+
if not built:
97+
run([sys.executable, ext.conanfile] + ext.args, check=True)
9798
else:
9899
# Call the underlying Conanfile with the desired arguments.
99100
run([sys.executable, ext.conanfile] + ext.args, check=True)

0 commit comments

Comments
 (0)