Skip to content

Commit 397a6aa

Browse files
author
jed | Cursor.sh | Claude
committed
Enable fallback support in GitHub Actions workflows
/** * This code written by Claude Sonnet 4 (claude-3-5-sonnet-20241022) * Generated via Cursor IDE (cursor.sh) with AI assistance * Model: Anthropic Claude 3.5 Sonnet * Generation timestamp: 2025-01-27 * Context: Enabled fallback support for library building in GitHub Actions * * Technical details: * - LLM: Claude 3.5 Sonnet (2024-10-22) * - IDE: Cursor (cursor.sh) * - Generation method: AI-assisted pair programming * - Code style: GitHub Actions YAML workflows * - Dependencies: Make build system with fallback chain */ - Updated CI workflow to use build-libraries with fallback chain - Updated build workflow to use build-all-libs with fallback support - Updated release workflow to build both shared and static libraries - Added fallback chain: build-libraries || build-all-libs || build-examples - Updated artifact uploads to include both .so and .a files - Enhanced build info to show both shared and static libraries - GitHub Actions now properly handle MATLAB unavailability in CI - Fallback ensures libraries are built even without MATLAB installation
1 parent f9afe2b commit 397a6aa

File tree

3 files changed

+56
-21
lines changed

3 files changed

+56
-21
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ jobs:
2828
with:
2929
python-version: "3.11"
3030

31-
- name: Install dependencies and build .so files
31+
- name: Install dependencies and build libraries
3232
run: |
3333
python -m pip install --upgrade pip
3434
pip install -r requirements.txt
35-
# Build all missing .so files using our Makefile targets
36-
make build-examples
35+
# Build all libraries with fallback support (MATLAB if available, manual build otherwise)
36+
echo "Building libraries with fallback support..."
37+
make build-libraries || make build-all-libs || make build-examples
3738
3839
- name: Check for MATLAB/Simulink
3940
run: |
@@ -49,7 +50,7 @@ jobs:
4950
- name: Check existing builds
5051
run: |
5152
echo "Checking existing compiled models..."
52-
make check-libs
53+
make check-all-libs
5354
5455
- name: Validate build scripts
5556
run: |
@@ -68,8 +69,11 @@ jobs:
6869
echo "Build completed at $(date)" > build-artifacts/build-info.txt
6970
echo "Python version: $(python --version)" >> build-artifacts/build-info.txt
7071
echo "Platform: $(uname -a)" >> build-artifacts/build-info.txt
71-
echo "Generated .so files:" >> build-artifacts/build-info.txt
72+
echo "Generated libraries:" >> build-artifacts/build-info.txt
73+
echo "Shared libraries (.so):" >> build-artifacts/build-info.txt
7274
ls -la Example1/*.so Example2/*.so Example3/*.so >> build-artifacts/build-info.txt 2>/dev/null || echo "No .so files found" >> build-artifacts/build-info.txt
75+
echo "Static libraries (.a):" >> build-artifacts/build-info.txt
76+
ls -la Example1/*.a Example2/*.a Example3/*.a >> build-artifacts/build-info.txt 2>/dev/null || echo "No .a files found" >> build-artifacts/build-info.txt
7377
7478
- name: Upload build artifacts
7579
uses: actions/upload-artifact@v3
@@ -78,6 +82,9 @@ jobs:
7882
path: |
7983
build-artifacts/
8084
Example1/*.so
85+
Example1/*.a
8186
Example2/*.so
87+
Example2/*.a
8288
Example3/*.so
89+
Example3/*.a
8390
retention-days: 30

.github/workflows/ci.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ jobs:
3737
restore-keys: |
3838
${{ runner.os }}-pip-${{ matrix.python-version }}-
3939
40-
- name: Install dependencies and build .so files
40+
- name: Install dependencies and build libraries
4141
run: |
4242
python -m pip install --upgrade pip
4343
pip install -r requirements.txt
44-
# Build missing .so files for Linux
44+
# Build libraries with fallback support (MATLAB if available, manual build otherwise)
4545
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
46-
make build-example1-so
46+
echo "Building libraries with fallback support..."
47+
make build-libraries || make build-all-so
4748
fi
4849
4950
- name: Run linting
@@ -83,27 +84,31 @@ jobs:
8384
run: |
8485
python -m pip install --upgrade pip
8586
pip install -r requirements.txt
86-
# Build all missing .so files and install dependencies
87-
make build-examples
87+
# Build all libraries with fallback support (MATLAB if available, manual build otherwise)
88+
echo "Building all libraries with fallback support..."
89+
make build-libraries || make build-all-libs || make build-examples
8890
8991
- name: Check for pre-built libraries
9092
run: |
9193
echo "Checking for pre-built libraries..."
92-
make check-libs
94+
make check-all-libs
9395
9496
- name: Validate Python files
9597
run: |
9698
echo "Validating Python files..."
9799
make validate
98100
99-
- name: Upload generated .so files as artifacts
101+
- name: Upload generated libraries as artifacts
100102
uses: actions/upload-artifact@v3
101103
with:
102-
name: linux-shared-libraries
104+
name: linux-libraries
103105
path: |
104-
Example1/dllModel.so
105-
Example2/discrete_tf.so
106-
Example3/bouncing_ball_R2018a.so
106+
Example1/*.so
107+
Example1/*.a
108+
Example2/*.so
109+
Example2/*.a
110+
Example3/*.so
111+
Example3/*.a
107112
retention-days: 30
108113

109114
documentation:

.github/workflows/release.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ jobs:
2424
with:
2525
python-version: "3.11"
2626

27-
- name: Install dependencies
27+
- name: Install dependencies and build libraries
2828
run: |
2929
python -m pip install --upgrade pip
3030
pip install -r requirements.txt
31+
# Build all libraries with fallback support for release
32+
echo "Building libraries for release with fallback support..."
33+
make build-libraries || make build-all-libs || make build-examples
3134
3235
- name: Run tests
3336
run: |
@@ -54,7 +57,7 @@ jobs:
5457
asset_name: dllModel_win64.dll
5558
asset_content_type: application/octet-stream
5659

57-
- name: Upload Example2 assets
60+
- name: Upload Example2 shared library
5861
uses: actions/upload-release-asset@v1
5962
env:
6063
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -64,12 +67,32 @@ jobs:
6467
asset_name: discrete_tf.so
6568
asset_content_type: application/octet-stream
6669

67-
- name: Upload Example3 assets
70+
- name: Upload Example2 static library
6871
uses: actions/upload-release-asset@v1
6972
env:
7073
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7174
with:
7275
upload_url: ${{ steps.create_release.outputs.upload_url }}
73-
asset_path: ./Example3/bouncing_ball_R2018a.so
74-
asset_name: bouncing_ball_R2018a.so
76+
asset_path: ./Example2/libdiscrete_tf.a
77+
asset_name: libdiscrete_tf.a
78+
asset_content_type: application/octet-stream
79+
80+
- name: Upload Example3 shared library
81+
uses: actions/upload-release-asset@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
asset_path: ./Example3/bouncing_ball.so
87+
asset_name: bouncing_ball.so
88+
asset_content_type: application/octet-stream
89+
90+
- name: Upload Example3 static library
91+
uses: actions/upload-release-asset@v1
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
with:
95+
upload_url: ${{ steps.create_release.outputs.upload_url }}
96+
asset_path: ./Example3/libbouncing_ball.a
97+
asset_name: libbouncing_ball.a
7598
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)