Skip to content

Commit 4ad1d13

Browse files
committed
Add CI workflow for testing trace plugin
1 parent 1ffb6c0 commit 4ad1d13

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

.github/workflows/ci.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
LOG_LEVEL: 4
11+
12+
jobs:
13+
test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest, macos-latest]
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
#===========================================
22+
# Checkout
23+
#===========================================
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
28+
29+
#===========================================
30+
# Install Java for lfc-dev
31+
#===========================================
32+
- name: Install Java 17
33+
uses: actions/setup-java@v4
34+
with:
35+
distribution: 'temurin'
36+
java-version: '17'
37+
38+
#===========================================
39+
# Install system dependencies
40+
#===========================================
41+
- name: Install system dependencies (Ubuntu)
42+
if: runner.os == 'Linux'
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y cmake build-essential zlib1g-dev
46+
47+
- name: Install system dependencies (macOS)
48+
if: runner.os == 'macOS'
49+
run: |
50+
brew install cmake
51+
52+
#===========================================
53+
# Build lfc-dev from lingua-franca master
54+
#===========================================
55+
- name: Cache Gradle dependencies
56+
uses: actions/cache@v4
57+
with:
58+
path: |
59+
~/.gradle/caches
60+
~/.gradle/wrapper
61+
key: gradle-${{ runner.os }}-lfc
62+
restore-keys: |
63+
gradle-${{ runner.os }}-
64+
65+
- name: Cache lingua-franca repository
66+
id: lfc-repo-cache
67+
uses: actions/cache@v4
68+
with:
69+
path: lingua-franca
70+
key: lfc-repo-${{ runner.os }}-master-${{ github.run_id }}
71+
restore-keys: |
72+
lfc-repo-${{ runner.os }}-master-
73+
74+
- name: Clone lingua-franca
75+
run: |
76+
if [ ! -d "lingua-franca" ]; then
77+
git clone --depth 1 https://github.com/lf-lang/lingua-franca.git
78+
fi
79+
80+
- name: Update and build lfc-dev
81+
run: |
82+
cd lingua-franca
83+
git fetch origin master --depth 1
84+
git checkout FETCH_HEAD
85+
./gradlew :cli:lfc-dev:assemble -x test
86+
87+
- name: Add lfc-dev to PATH
88+
run: |
89+
echo "${{ github.workspace }}/lingua-franca/org.lflang.cli/build/install/lfc-dev/bin" >> $GITHUB_PATH
90+
91+
- name: Verify lfc-dev installation
92+
run: lfc-dev --version
93+
94+
#===========================================
95+
# Build the trace plugin
96+
#===========================================
97+
- name: Cache plugin build dependencies
98+
uses: actions/cache@v4
99+
with:
100+
path: build/_deps
101+
key: plugin-deps-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'third-party/**/*.cmake', '.gitmodules') }}
102+
restore-keys: |
103+
plugin-deps-${{ runner.os }}-
104+
105+
- name: Build plugin
106+
run: ./build.sh --log-level ${{ env.LOG_LEVEL }}
107+
108+
#===========================================
109+
# Install plugin to repo root ./install/
110+
# (for TracePluginUserPath.lf and TracePluginCustomCmake.lf)
111+
#===========================================
112+
- name: Install plugin to ./install/
113+
run: cmake --install build --prefix "${{ github.workspace }}/install"
114+
115+
- name: Verify ./install/ contents
116+
run: |
117+
ls -la "${{ github.workspace }}/install/"
118+
ls -la "${{ github.workspace }}/install/lib/" | head -20
119+
120+
#===========================================
121+
# Install plugin to system path
122+
# (for TracePluginSystemPath.lf)
123+
#===========================================
124+
- name: Install plugin to system path (Linux)
125+
if: runner.os == 'Linux'
126+
run: sudo cmake --install build
127+
128+
- name: Install plugin to system path (macOS)
129+
if: runner.os == 'macOS'
130+
run: cmake --install build
131+
132+
- name: Verify system installation
133+
run: |
134+
ls -la /usr/local/lib/cmake/lf-trace-xronos/ || echo "CMake config not found at /usr/local"
135+
ls /usr/local/lib/liblf-trace-impl.a || echo "Library not found at /usr/local"
136+
137+
#===========================================
138+
# Test 1: TracePluginSystemPath.lf
139+
# Uses system-installed plugin (no path specified)
140+
#===========================================
141+
- name: Compile TracePluginSystemPath.lf
142+
run: lfc-dev tests/src/TracePluginSystemPath.lf
143+
144+
- name: Run TracePluginSystemPath
145+
run: ./tests/bin/TracePluginSystemPath
146+
timeout-minutes: 2
147+
148+
#===========================================
149+
# Test 2: TracePluginUserPath.lf
150+
# Uses path: "../../install/" relative to .lf file
151+
#===========================================
152+
- name: Compile TracePluginUserPath.lf
153+
run: lfc-dev tests/src/TracePluginUserPath.lf
154+
155+
- name: Run TracePluginUserPath
156+
run: ./tests/bin/TracePluginUserPath
157+
timeout-minutes: 2
158+
159+
#===========================================
160+
# Test 3: TracePluginCustomCmake.lf
161+
# Uses cmake-include with plugin.cmake
162+
#===========================================
163+
- name: Compile TracePluginCustomCmake.lf
164+
run: lfc-dev tests/src/TracePluginCustomCmake.lf
165+
166+
- name: Run TracePluginCustomCmake
167+
run: ./tests/bin/TracePluginCustomCmake
168+
timeout-minutes: 2

0 commit comments

Comments
 (0)