Skip to content

Commit 7244fad

Browse files
committed
.github: include flavor in target
There are 2 main reasons for this: 1) It's almost impossible to write complex logical expressions in GH workflows. I wanted to pass "" as flavor when not building _minimal. So that the end target string would become TARGET + FLAVOR where FLAVOR is empty, making it x86_64 for example. As it turns out "" is false in GH workflow logical expressions, this in conjunction with the limitations the interpreter has made it hard to actually write sane expressions in the "with:" variables when calling downstream jobs via workflow calls. Here's an example of what I was trying to do and could not: with: flavor: ${{ ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main') ) && '' || '_minimal' }} As '' is false, the first sets of expressions always evaluates to false making the string "_minimal". I tried bracing this in various ways and to use "null" or various JSON objects, all in vain. 2) It reduces complexity instead of adding additional. Signed-off-by: Richard Alpe <[email protected]>
1 parent 33c95e8 commit 7244fad

File tree

4 files changed

+18
-38
lines changed

4 files changed

+18
-38
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
target:
7-
description: "Build target (e.g. aarch64)"
7+
description: "Build target (e.g. aarch64 or aarch64_minimal)"
88
default: "x86_64"
99
type: string
10-
flavor:
11-
description: 'Optional build flavor (e.g. _minimal)'
12-
default: ''
13-
type: string
1410
parallel:
1511
description: 'Massive parallel build of each image'
1612
default: true
@@ -32,10 +28,6 @@ on:
3228
name:
3329
required: true
3430
type: string
35-
flavor:
36-
required: false
37-
type: string
38-
default: ''
3931
infix_repo:
4032
required: false
4133
type: string
@@ -48,7 +40,6 @@ on:
4840
env:
4941
NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
5042
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
51-
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
5243
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
5344

5445
jobs:
@@ -96,8 +87,7 @@ jobs:
9687
name=${{ env.NAME }}
9788
echo "dir=${name}-${target}" >> $GITHUB_OUTPUT
9889
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
99-
echo "flv=$FLV" >> $GITHUB_OUTPUT
100-
echo "Building target ${target}${FLV}_defconfig"
90+
echo "Building target ${target}_defconfig"
10191
10292
- name: Restore Cache of dl/
10393
uses: actions/cache@v4
@@ -116,9 +106,9 @@ jobs:
116106
ccache-${{ env.TARGET }}-
117107
ccache-
118108
119-
- name: Configure ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
109+
- name: Configure ${{ env.TARGET }}
120110
run: |
121-
make ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig
111+
make ${{ env.TARGET }}_defconfig
122112
123113
- name: Unit Test ${{ env.TARGET }}
124114
run: |
@@ -138,9 +128,9 @@ jobs:
138128
fi
139129
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
140130
141-
- name: Build ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
131+
- name: Build ${{ env.TARGET }}
142132
run: |
143-
echo "Building ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig ..."
133+
echo "Building ${{ env.TARGET }}_defconfig ..."
144134
eval "${{ steps.parallel.outputs.MAKE }}"
145135
146136
- name: Check SBOM from Build

.github/workflows/generic-x86-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
echo "INFIX_BUILD_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT
3636
echo "dir=Infix-x86_64" >> $GITHUB_OUTPUT
3737
echo "tgz=Infix-x86_64.tar.gz" >> $GITHUB_OUTPUT
38-
echo "flv=_minimal" >> $GITHUB_OUTPUT
3938
4039
- name: Configure x86_64_minimal
4140
run: |

.github/workflows/test.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ on:
1717
name:
1818
required: true
1919
type: string
20-
flavor:
21-
required: false
22-
type: string
23-
default: ''
2420
infix_repo:
2521
required: false
2622
type: string
@@ -35,14 +31,14 @@ on:
3531
default: 'test'
3632

3733
env:
38-
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
34+
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
3935
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
4036
NINEPM_CONF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ninepm-conf || inputs.ninepm-conf }}
4137
TEST_PATH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test-path || inputs.test-path }}
4238

4339
jobs:
4440
test:
45-
name: Regression Test ${{ inputs.name }} ${{ inputs.target }}
41+
name: Regression Test ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }} ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
4642
runs-on: [ self-hosted, regression ]
4743
steps:
4844
- name: Checkout infix repo
@@ -62,20 +58,18 @@ jobs:
6258
>>$GITHUB_ENV
6359
fi
6460
65-
echo "flv=$FLV" >> $GITHUB_OUTPUT
66-
67-
- name: Configure ${{ inputs.target }}${{ steps.vars.outputs.flv }}
61+
- name: Configure ${{ env.TARGET }}
6862
run: |
69-
make ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig
63+
make ${{ env.TARGET }}_defconfig
7064
7165
- uses: actions/download-artifact@v4
7266
with:
7367
pattern: "artifact-*"
7468
merge-multiple: true
7569

76-
- name: Restore x86-64${{ steps.vars.outputs.flv }} output/
70+
- name: Restore ${{ env.TARGET }} output/
7771
run: |
78-
target=${{ inputs.target }}
72+
target=${{ env.TARGET }}
7973
name=${{ inputs.name }}
8074
8175
ls -l
@@ -85,20 +79,20 @@ jobs:
8579
tar xf ${name}-${target}.tar.gz
8680
ln -s ${name}-${target} images
8781
88-
- name: Regression Test x86_64${{ steps.vars.outputs.flv }}
82+
- name: Regression Test ${{ env.TARGET }}
8983
run: |
9084
if [ -n "$NINEPM_CONF" ]; then
9185
export NINEPM_PROJ_CONFIG="${GITHUB_WORKSPACE}/$NINEPM_CONF"
9286
echo "DEBUG: NINEPM_PROJ_CONFIG is '$NINEPM_PROJ_CONFIG'"
9387
fi
9488
make test
9589
96-
- name: Publish Test Result for x86_64${{ steps.vars.outputs.flv }}
90+
- name: Publish Test Result for ${{ env.TARGET }}
9791
# Ensure this runs even if Regression Test fails
9892
if: always()
9993
run: cat $TEST_PATH/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
10094

101-
- name: Generate Test Report for x86_64${{ steps.vars.outputs.flv }}
95+
- name: Generate Test Report for ${{ env.TARGET }}
10296
# Ensure this runs even if Regression Test fails
10397
if: always()
10498
run: |

.github/workflows/trigger.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,25 @@ jobs:
1414
if: startsWith(github.repository, 'kernelkit/')
1515
uses: ./.github/workflows/build.yml
1616
with:
17-
target: "x86_64"
1817
name: "infix"
19-
flavor: "_minimal"
18+
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'x86_64' || 'x86_64_minimal' }}
2019

2120
build-aarch64:
2221
if: startsWith(github.repository, 'kernelkit/')
2322
uses: ./.github/workflows/build.yml
2423
with:
25-
target: "aarch64"
2624
name: "infix"
27-
flavor: "_minimal"
25+
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'aarch64' || 'aarch64_minimal' }}
2826

2927
test-run-x86_64:
3028
if: startsWith(github.repository, 'kernelkit/')
3129
needs: build-x86_64
3230
uses: ./.github/workflows/test.yml
3331
with:
34-
target: "x86_64"
32+
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'x86_64' || 'x86_64_minimal' }}
3533
name: "infix"
3634

3735
test-publish-x86_64:
3836
if: startsWith(github.repository, 'kernelkit/')
3937
needs: test-run-x86_64
4038
uses: ./.github/workflows/publish.yml
41-

0 commit comments

Comments
 (0)