.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 <richard@bit42.se>
This commit is contained in:
Richard Alpe
2025-08-26 14:37:13 +02:00
parent 33c95e860b
commit 7244fad2e8
4 changed files with 18 additions and 38 deletions
+6 -16
View File
@@ -4,13 +4,9 @@ on:
workflow_dispatch:
inputs:
target:
description: "Build target (e.g. aarch64)"
description: "Build target (e.g. aarch64 or aarch64_minimal)"
default: "x86_64"
type: string
flavor:
description: 'Optional build flavor (e.g. _minimal)'
default: ''
type: string
parallel:
description: 'Massive parallel build of each image'
default: true
@@ -32,10 +28,6 @@ on:
name:
required: true
type: string
flavor:
required: false
type: string
default: ''
infix_repo:
required: false
type: string
@@ -48,7 +40,6 @@ on:
env:
NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
jobs:
@@ -96,8 +87,7 @@ jobs:
name=${{ env.NAME }}
echo "dir=${name}-${target}" >> $GITHUB_OUTPUT
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
echo "flv=$FLV" >> $GITHUB_OUTPUT
echo "Building target ${target}${FLV}_defconfig"
echo "Building target ${target}_defconfig"
- name: Restore Cache of dl/
uses: actions/cache@v4
@@ -116,9 +106,9 @@ jobs:
ccache-${{ env.TARGET }}-
ccache-
- name: Configure ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
- name: Configure ${{ env.TARGET }}
run: |
make ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig
make ${{ env.TARGET }}_defconfig
- name: Unit Test ${{ env.TARGET }}
run: |
@@ -138,9 +128,9 @@ jobs:
fi
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
- name: Build ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
- name: Build ${{ env.TARGET }}
run: |
echo "Building ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig ..."
echo "Building ${{ env.TARGET }}_defconfig ..."
eval "${{ steps.parallel.outputs.MAKE }}"
- name: Check SBOM from Build
-1
View File
@@ -35,7 +35,6 @@ jobs:
echo "INFIX_BUILD_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT
echo "dir=Infix-x86_64" >> $GITHUB_OUTPUT
echo "tgz=Infix-x86_64.tar.gz" >> $GITHUB_OUTPUT
echo "flv=_minimal" >> $GITHUB_OUTPUT
- name: Configure x86_64_minimal
run: |
+9 -15
View File
@@ -17,10 +17,6 @@ on:
name:
required: true
type: string
flavor:
required: false
type: string
default: ''
infix_repo:
required: false
type: string
@@ -35,14 +31,14 @@ on:
default: 'test'
env:
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
NINEPM_CONF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ninepm-conf || inputs.ninepm-conf }}
TEST_PATH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test-path || inputs.test-path }}
jobs:
test:
name: Regression Test ${{ inputs.name }} ${{ inputs.target }}
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 }}
runs-on: [ self-hosted, regression ]
steps:
- name: Checkout infix repo
@@ -62,20 +58,18 @@ jobs:
>>$GITHUB_ENV
fi
echo "flv=$FLV" >> $GITHUB_OUTPUT
- name: Configure ${{ inputs.target }}${{ steps.vars.outputs.flv }}
- name: Configure ${{ env.TARGET }}
run: |
make ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig
make ${{ env.TARGET }}_defconfig
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Restore x86-64${{ steps.vars.outputs.flv }} output/
- name: Restore ${{ env.TARGET }} output/
run: |
target=${{ inputs.target }}
target=${{ env.TARGET }}
name=${{ inputs.name }}
ls -l
@@ -85,7 +79,7 @@ jobs:
tar xf ${name}-${target}.tar.gz
ln -s ${name}-${target} images
- name: Regression Test x86_64${{ steps.vars.outputs.flv }}
- name: Regression Test ${{ env.TARGET }}
run: |
if [ -n "$NINEPM_CONF" ]; then
export NINEPM_PROJ_CONFIG="${GITHUB_WORKSPACE}/$NINEPM_CONF"
@@ -93,12 +87,12 @@ jobs:
fi
make test
- name: Publish Test Result for x86_64${{ steps.vars.outputs.flv }}
- name: Publish Test Result for ${{ env.TARGET }}
# Ensure this runs even if Regression Test fails
if: always()
run: cat $TEST_PATH/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
- name: Generate Test Report for x86_64${{ steps.vars.outputs.flv }}
- name: Generate Test Report for ${{ env.TARGET }}
# Ensure this runs even if Regression Test fails
if: always()
run: |
+3 -6
View File
@@ -14,28 +14,25 @@ jobs:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "x86_64"
name: "infix"
flavor: "_minimal"
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'x86_64' || 'x86_64_minimal' }}
build-aarch64:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "aarch64"
name: "infix"
flavor: "_minimal"
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'aarch64' || 'aarch64_minimal' }}
test-run-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: build-x86_64
uses: ./.github/workflows/test.yml
with:
target: "x86_64"
target: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:main')) && 'x86_64' || 'x86_64_minimal' }}
name: "infix"
test-publish-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: test-run-x86_64
uses: ./.github/workflows/publish.yml