Skip to content

Commit 9386f00

Browse files
authored
Merge pull request #1279 from kernelkit/ci-improvements
CI: Add workflow customization for upstream callers [skip ci]
2 parents cd94de7 + 79ec2fb commit 9386f00

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
description: 'Repo to checkout (for spin overrides)'
2020
default: kernelkit/infix
2121
type: string
22+
infix_branch:
23+
description: 'Branch/tag/commit to checkout (for spin overrides)'
24+
default: ''
25+
type: string
2226

2327
workflow_call:
2428
inputs:
@@ -32,6 +36,11 @@ on:
3236
required: false
3337
type: string
3438
default: kernelkit/infix
39+
infix_branch:
40+
required: false
41+
type: string
42+
default: ''
43+
description: 'Branch/tag/commit to checkout (for spin overrides). Defaults to github.ref if not specified'
3544
parallel:
3645
required: false
3746
type: boolean
@@ -50,6 +59,7 @@ env:
5059
NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
5160
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
5261
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
62+
INFIX_BRANCH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_branch || inputs.infix_branch }}
5363

5464
jobs:
5565
build:
@@ -82,7 +92,7 @@ jobs:
8292
uses: actions/checkout@v4
8393
with:
8494
repository: ${{ env.INFIX_REPO }}
85-
ref: ${{ github.ref }}
95+
ref: ${{ env.INFIX_BRANCH != '' && env.INFIX_BRANCH || github.ref }}
8696
clean: true
8797
fetch-depth: 0
8898
submodules: recursive

.github/workflows/test.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
required: false
99
default: kernelkit/infix
1010
type: string
11+
infix_branch:
12+
description: 'Branch/tag/commit to checkout (for spin overrides)'
13+
default: ''
14+
type: string
1115

1216
workflow_call:
1317
inputs:
@@ -21,6 +25,11 @@ on:
2125
required: false
2226
type: string
2327
default: kernelkit/infix
28+
infix_branch:
29+
required: false
30+
type: string
31+
default: ''
32+
description: 'Branch/tag/commit to checkout (for spin overrides). Defaults to github.ref if not specified'
2433
ninepm-conf:
2534
required: false
2635
type: string
@@ -29,6 +38,11 @@ on:
2938
required: false
3039
type: string
3140
default: 'test'
41+
pre_test_script:
42+
required: false
43+
type: string
44+
default: ''
45+
description: 'Optional script to run after checkout (for spin customization)'
3246
secrets:
3347
CHECKOUT_TOKEN:
3448
required: false
@@ -37,6 +51,7 @@ on:
3751
env:
3852
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
3953
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
54+
INFIX_BRANCH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_branch || inputs.infix_branch }}
4055
NINEPM_CONF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ninepm-conf || inputs.ninepm-conf }}
4156
TEST_PATH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test-path || inputs.test-path }}
4257

@@ -59,12 +74,21 @@ jobs:
5974
uses: actions/checkout@v4
6075
with:
6176
repository: ${{ env.INFIX_REPO }}
62-
ref: ${{ github.ref }}
77+
ref: ${{ env.INFIX_BRANCH != '' && env.INFIX_BRANCH || github.ref }}
6378
clean: true
6479
fetch-depth: 0
6580
submodules: recursive
6681
token: ${{ secrets.CHECKOUT_TOKEN || github.token }}
6782

83+
- name: Run pre-test script
84+
if: ${{ inputs.pre_test_script != '' }}
85+
run: |
86+
cat > ./pre-test.sh << 'EOF'
87+
${{ inputs.pre_test_script }}
88+
EOF
89+
chmod +x ./pre-test.sh
90+
bash ./pre-test.sh
91+
6892
- name: Set Build Variables
6993
id: vars
7094
run: |

0 commit comments

Comments
 (0)