-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (80 loc) · 2.91 KB
/
build.yml
File metadata and controls
90 lines (80 loc) · 2.91 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
name: Build Simulink Models
on:
push:
branches: [ main, develop ]
paths:
- '**/*.slx'
- '**/*.mdl'
- '**/*.m'
pull_request:
branches: [ main, develop ]
paths:
- '**/*.slx'
- '**/*.mdl'
- '**/*.m'
workflow_dispatch:
jobs:
build-models:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies and build libraries
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Build all libraries with fallback support (MATLAB if available, manual build otherwise)
echo "Building libraries with fallback support..."
make build-libraries || make build-all-libs || make build-examples
- name: Check for MATLAB/Simulink
run: |
echo "Checking for MATLAB installation..."
if command -v matlab &> /dev/null; then
echo "MATLAB found"
matlab -batch "disp('MATLAB is available')"
else
echo "MATLAB not found - skipping model compilation"
echo "This is expected in CI environments without MATLAB"
fi
- name: Check existing builds
run: |
echo "Checking existing compiled models..."
make check-all-libs
- name: Validate build scripts
run: |
echo "Validating build scripts..."
echo "Example1 build script:"
cat Example1/dllModel_build.m
echo "Example2 build script:"
cat Example2/discrete_tf_build.m
echo "Example3 build script:"
cat Example3/bouncing_ball_build.m
- name: Create build artifacts
run: |
echo "Creating build artifacts directory..."
mkdir -p build-artifacts
echo "Build completed at $(date)" > build-artifacts/build-info.txt
echo "Python version: $(python --version)" >> build-artifacts/build-info.txt
echo "Platform: $(uname -a)" >> build-artifacts/build-info.txt
echo "Generated libraries:" >> build-artifacts/build-info.txt
echo "Shared libraries (.so):" >> build-artifacts/build-info.txt
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
echo "Static libraries (.a):" >> build-artifacts/build-info.txt
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
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
build-artifacts/
Example1/*.so
Example1/*.a
Example2/*.so
Example2/*.a
Example3/*.so
Example3/*.a
retention-days: 30