mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
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>
111 lines
3.4 KiB
YAML
111 lines
3.4 KiB
YAML
name: Test Infix
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
infix_repo:
|
|
description: 'Repo to checkout (for spin overrides)'
|
|
required: false
|
|
default: kernelkit/infix
|
|
type: string
|
|
|
|
workflow_call:
|
|
inputs:
|
|
target:
|
|
required: true
|
|
type: string
|
|
name:
|
|
required: true
|
|
type: string
|
|
infix_repo:
|
|
required: false
|
|
type: string
|
|
default: kernelkit/infix
|
|
ninepm-conf:
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
test-path:
|
|
required: false
|
|
type: string
|
|
default: 'test'
|
|
|
|
env:
|
|
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 ${{ 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
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ env.INFIX_REPO }}
|
|
ref: ${{ github.ref }}
|
|
clean: true
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Set Build Variables
|
|
id: vars
|
|
run: |
|
|
if [ -n "${{ needs.build.outputs.build_id }}" ]; then
|
|
echo "INFIX_BUILD_ID=${{ needs.build.outputs.build_id }}" \
|
|
>>$GITHUB_ENV
|
|
fi
|
|
|
|
- name: Configure ${{ env.TARGET }}
|
|
run: |
|
|
make ${{ env.TARGET }}_defconfig
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: "artifact-*"
|
|
merge-multiple: true
|
|
|
|
- name: Restore ${{ env.TARGET }} output/
|
|
run: |
|
|
target=${{ env.TARGET }}
|
|
name=${{ inputs.name }}
|
|
|
|
ls -l
|
|
mkdir -p output
|
|
mv ${name}-${target}.tar.gz output/
|
|
cd output/
|
|
tar xf ${name}-${target}.tar.gz
|
|
ln -s ${name}-${target} images
|
|
|
|
- name: Regression Test ${{ env.TARGET }}
|
|
run: |
|
|
if [ -n "$NINEPM_CONF" ]; then
|
|
export NINEPM_PROJ_CONFIG="${GITHUB_WORKSPACE}/$NINEPM_CONF"
|
|
echo "DEBUG: NINEPM_PROJ_CONFIG is '$NINEPM_PROJ_CONFIG'"
|
|
fi
|
|
make test
|
|
|
|
- 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 ${{ env.TARGET }}
|
|
# Ensure this runs even if Regression Test fails
|
|
if: always()
|
|
run: |
|
|
asciidoctor-pdf \
|
|
--theme $TEST_PATH/9pm/report/theme.yml \
|
|
-a pdf-fontsdir=$TEST_PATH/9pm/report/fonts \
|
|
$TEST_PATH/.log/last/report.adoc \
|
|
-o $TEST_PATH/.log/last/report.pdf
|
|
|
|
- name: Upload Test Report as Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-report
|
|
path: ${{ env.TEST_PATH }}/.log/last/report.pdf
|
|
|