Skip to content

Commit 1b5888f

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 085d549 commit 1b5888f

11 files changed

Lines changed: 82 additions & 140 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 & 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/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

0 commit comments

Comments
 (0)