Skip to content

Commit 8b14def

Browse files
Build and test latest for Windows and Linux. Build and Test all support python versions for macOS
1 parent 085d549 commit 8b14def

8 files changed

Lines changed: 76 additions & 137 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:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: pre-commit
2+
description: Run pre-commit on changed files with Python 3.11
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: actions/setup-python@v5
8+
with:
9+
python-version: 3.11
10+
11+
- id: file_changes
12+
uses: tj-actions/changed-files@v44
13+
- uses: pre-commit/action@v3.0.1
14+
with:
15+
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files }}

.github/workflows/canary.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ jobs:
3737
uses: ./.github/actions/build
3838
with:
3939
python-version: ${{ matrix.python-version }}
40-
build-mode: conan
41-
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True --pyPkgCanary True
40+
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --pyPkgCanary True
4241
is-canary: true
43-
install-doc-reqs: true
4442
- name: Capture final package versions
4543
run: |
4644
pip freeze > final_versions.txt
@@ -49,16 +47,17 @@ jobs:
4947
echo "\n" >> $GITHUB_STEP_SUMMARY
5048
echo "Package version changes:" >> $GITHUB_STEP_SUMMARY
5149
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() }}
50+
# NOTE: The documentation depends on images generated by executing the
51+
# Python tests successfully. As such, the "Build docs" action below
52+
# handles running the Python tests internally
5653
- name: Run C/C++ Tests
5754
working-directory: ./dist3
5855
run: ctest -C Release
5956
if: ${{ always() }}
6057
- name: Build docs
6158
uses: ./.github/actions/docs
59+
with:
60+
is-canary: true
6261
- name: Upload package version logs
6362
if: always()
6463
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/pre-commit.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
name: "Pre-commit"
2-
1+
name: Pre-commit
32
on:
4-
pull_request:
53
workflow_dispatch:
64

75
jobs:
86
pre-commit:
97
runs-on: ubuntu-22.04
108
steps:
119
- uses: actions/checkout@v4
12-
- uses: actions/setup-python@v5
13-
with:
14-
python-version: 3.11
15-
- id: file_changes
16-
uses: tj-actions/changed-files@v44
17-
- uses: pre-commit/action@v3.0.1
18-
with:
19-
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files}}
10+
- uses: ./.github/actions/pre-commit

.github/workflows/pull-request.yml

Lines changed: 29 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13,88 +13,47 @@ 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
50-
run: |
51-
if [ "${{ matrix.error_for_skips || 'false' }}" = "true" ]; then
52-
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
53-
else
54-
pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
55-
fi
35+
run: pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
5636
- name: CTest
5737
if: ${{ always() }}
5838
working-directory: dist3
5939
run: ctest
6040

61-
# Perform a Basilisk build with all newer supported python versions using the
62-
# pip install based approach.
63-
build-linux-pip:
64-
runs-on: ubuntu-22.04
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
python: ["3.11", "3.12", "3.13"]
69-
name: Linux (pip, ${{ matrix.python }})
70-
steps:
71-
- uses: actions/checkout@v4
72-
- uses: ./.github/actions/build
73-
with:
74-
python-version: ${{ matrix.python }}
75-
build-mode: pip
76-
- name: Pytest
77-
working-directory: src
78-
run: pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
79-
80-
# Perform a Basilisk build with Python 3.11 using the conanfile install based
81-
# approach.
8241
build-windows:
8342
runs-on: windows-2025
84-
timeout-minutes: 100
43+
timeout-minutes: 90
44+
needs: pre-commit
8545
strategy:
8646
fail-fast: false
8747
matrix:
88-
python: ["3.11"]
89-
name: Windows (Conanfile, ${{ matrix.python }})
48+
python: ["3.13"]
49+
name: Windows (${{ matrix.python }})
9050
env:
9151
MPLBACKEND: agg
9252
steps:
9353
- uses: actions/checkout@v4
9454
- uses: ./.github/actions/build
9555
with:
9656
python-version: ${{ matrix.python }}
97-
build-mode: conan
9857
conan-args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
9958
- name: Pytest
10059
shell: pwsh
@@ -110,40 +69,36 @@ jobs:
11069
ctest
11170
if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) { exit 1 }
11271
113-
# Perform a Basilisk build with modern python versions using the conanfile
114-
# install based approach. For Python 3.11 we perform a no viz build.
11572
build-macos:
11673
runs-on: macos-latest
117-
timeout-minutes: 75
74+
timeout-minutes: 90
75+
needs: pre-commit
11876
strategy:
11977
fail-fast: false
12078
matrix:
121-
python: ["3.11", "3.12", "3.13"]
79+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
80+
pytest_flags:
81+
['-n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v']
82+
# Python 3.8 cannot run all tests.
83+
# TODO: Once Python 3.8 support is dropped, delete this include and exclude and remove 3.8 from the python
84+
# test matrix.
12285
include:
123-
- python: 3.11
124-
conan_args: "--vizInterface False"
125-
- python: 3.12
126-
conan_args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
127-
error_for_skips: true
128-
- python: 3.13
129-
conan_args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
130-
error_for_skips: true
131-
name: macOS (Conanfile, ${{ matrix.python }})
86+
- python: "3.8"
87+
pytest_flags: -n auto -m "not ciSkip" -rs --dist=loadscope -v -p no:pytest_forbid_skips
88+
exclude:
89+
- python: "3.8"
90+
pytest_flags: '-n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v'
91+
92+
name: macOS (${{ matrix.python }})
13293
steps:
13394
- uses: actions/checkout@v4
13495
- uses: ./.github/actions/build
13596
with:
13697
python-version: ${{ matrix.python }}
137-
build-mode: conan
138-
conan-args: ${{ matrix.conan_args }}
98+
conan-args: --opNav True --mujoco True --mujocoReplay True --recorderPropertyRollback True
13999
- name: Pytest
140100
working-directory: src
141-
run: |
142-
if [ "${{ matrix.error_for_skips || 'false' }}" = "true" ]; then
143-
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
144-
else
145-
pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
146-
fi
101+
run: pytest ${{ matrix.pytest_flags }}
147102
- name: CTest
148103
if: ${{ always() }}
149104
working-directory: dist3
@@ -158,8 +113,6 @@ jobs:
158113
uses: ./.github/actions/build
159114
with:
160115
python-version: 3.13
161-
build-mode: conan
162116
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True
163-
install-doc-reqs: true
164117
- name: Build docs
165118
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)