Skip to content

Commit cd6fc4e

Browse files
lsk567claude
andcommitted
Convert CI to reusable workflow
The workflow can now be called by other repos (e.g., lingua-franca): jobs: trace-plugin-tests: uses: lf-lang/lf-trace-xronos/.github/workflows/ci.yml@main with: lf-ref: 'live-tracing2' Inputs: - lf-ref: Git ref of lingua-franca to use (default: live-tracing2) - lf-trace-xronos-ref: Git ref of this repo to checkout (default: main) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f5b360d commit cd6fc4e

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,29 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8-
# Enable workflow_dispatch so that this CI workflow can be triggered by
9-
# the lingua-franca CI workflows.
108
workflow_dispatch:
9+
inputs:
10+
lf-ref:
11+
description: 'Git ref of lingua-franca to use'
12+
required: false
13+
default: 'live-tracing2'
14+
# Reusable workflow - can be called by other repos (e.g., lingua-franca)
15+
workflow_call:
16+
inputs:
17+
lf-ref:
18+
description: 'Git ref of lingua-franca to use'
19+
required: false
20+
type: string
21+
default: 'live-tracing2'
22+
lf-trace-xronos-ref:
23+
description: 'Git ref of lf-trace-xronos to checkout'
24+
required: false
25+
type: string
26+
default: 'main'
1127

1228
env:
1329
LOG_LEVEL: 4
30+
LF_REF: ${{ inputs.lf-ref || 'live-tracing2' }}
1431

1532
jobs:
1633
test:
@@ -27,6 +44,8 @@ jobs:
2744
- name: Checkout repository
2845
uses: actions/checkout@v4
2946
with:
47+
repository: lf-lang/lf-trace-xronos
48+
ref: ${{ inputs.lf-trace-xronos-ref || github.ref }}
3049
submodules: recursive
3150

3251
#===========================================
@@ -58,7 +77,7 @@ jobs:
5877
run: cmake --version
5978

6079
#===========================================
61-
# Build lfc from lingua-franca live-tracing2
80+
# Build lfc from lingua-franca
6281
#===========================================
6382
- name: Cache Gradle dependencies
6483
uses: actions/cache@v4
@@ -75,9 +94,9 @@ jobs:
7594
uses: actions/cache@v4
7695
with:
7796
path: lingua-franca
78-
key: lfc-repo-${{ runner.os }}-live-tracing2-${{ github.run_id }}
97+
key: lfc-repo-${{ runner.os }}-${{ env.LF_REF }}-${{ github.run_id }}
7998
restore-keys: |
80-
lfc-repo-${{ runner.os }}-live-tracing2-
99+
lfc-repo-${{ runner.os }}-${{ env.LF_REF }}-
81100
82101
- name: Clone lingua-franca
83102
run: |
@@ -88,7 +107,7 @@ jobs:
88107
- name: Update and build lfc
89108
run: |
90109
cd lingua-franca
91-
git fetch origin live-tracing2
110+
git fetch origin ${{ env.LF_REF }}
92111
git checkout FETCH_HEAD
93112
git submodule update --init --recursive
94113
./gradlew assemble

0 commit comments

Comments
 (0)