ci: check sim_string_list.h stays in sync with string_list.h (#7720)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
02432d4811
commit
9f7f642f1a
@@ -1,7 +1,9 @@
|
|||||||
name: 'Codegen drift check'
|
name: 'Codegen drift check'
|
||||||
description: >
|
description: >
|
||||||
Runs a Justfile codegen recipe and reports a warning - without failing the
|
Runs a Justfile codegen recipe and fails the job when the committed output
|
||||||
build - when the committed output differs from what the recipe produces.
|
differs from what the recipe produces. The job is deliberately not a
|
||||||
|
required status check, so drift is visible on the PR without blocking a
|
||||||
|
contributor who lacks the local toolchain from merging.
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
recipe:
|
recipe:
|
||||||
@@ -13,25 +15,11 @@ inputs:
|
|||||||
label:
|
label:
|
||||||
description: 'Human readable name of the generated artefact'
|
description: 'Human readable name of the generated artefact'
|
||||||
required: true
|
required: true
|
||||||
just-version:
|
|
||||||
description: 'Version of just to install'
|
|
||||||
default: '1.57.0'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Install just
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
JUST_VERSION: ${{ inputs.just-version }}
|
|
||||||
run: |
|
|
||||||
# The edgetx-dev image ships wget but not curl.
|
|
||||||
wget -qO- \
|
|
||||||
"https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
|
|
||||||
| tar xz -C /usr/local/bin just
|
|
||||||
just --version
|
|
||||||
|
|
||||||
- name: Allow git to read the workspace
|
- name: Allow git to read the workspace
|
||||||
shell: bash
|
shell: bash
|
||||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
@@ -60,8 +48,9 @@ runs:
|
|||||||
RECIPE: ${{ inputs.recipe }}
|
RECIPE: ${{ inputs.recipe }}
|
||||||
LABEL: ${{ inputs.label }}
|
LABEL: ${{ inputs.label }}
|
||||||
run: |
|
run: |
|
||||||
# Deliberately non-failing. Contributors without the local toolchain must
|
# This job is not a required status check (see description above), so
|
||||||
# not be blocked; this only surfaces that the committed files have drifted.
|
# failing here surfaces real drift on the PR without blocking a
|
||||||
|
# contributor who lacks the local toolchain from merging.
|
||||||
# Word splitting on PATHS is intentional - it may hold several pathspecs.
|
# Word splitting on PATHS is intentional - it may hold several pathspecs.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
changed=$(git status --porcelain -- ${PATHS})
|
changed=$(git status --porcelain -- ${PATHS})
|
||||||
@@ -70,13 +59,13 @@ runs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::warning::${LABEL} is out of date. Run 'just ${RECIPE}' and commit the result."
|
echo "::error::${LABEL} is out of date. Run 'just ${RECIPE}' and commit the result."
|
||||||
|
|
||||||
# A full regeneration diff can run to megabytes (the fonts are the worst
|
# A full regeneration diff can run to megabytes (the fonts are the worst
|
||||||
# case), so truncate well inside the 1 MiB step summary limit. Truncation
|
# case), so truncate well inside the 1 MiB step summary limit. Truncation
|
||||||
# uses bash substring expansion rather than `head`: piping into `head`
|
# uses bash substring expansion rather than `head`: piping into `head`
|
||||||
# would SIGPIPE the producer once it closed the pipe, and under `pipefail`
|
# would SIGPIPE the producer once it closed the pipe, and under `pipefail`
|
||||||
# that exits 141 - failing a step that must never fail.
|
# that would clobber the exit 1 below with a 141.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
diff=$(git diff -- ${PATHS} || true)
|
diff=$(git diff -- ${PATHS} || true)
|
||||||
truncated="${diff:0:60000}"
|
truncated="${diff:0:60000}"
|
||||||
@@ -85,7 +74,7 @@ runs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "### :warning: ${LABEL} is out of date"
|
echo "### :x: ${LABEL} is out of date"
|
||||||
echo
|
echo
|
||||||
echo "The committed files differ from what \`just ${RECIPE}\` produces in"
|
echo "The committed files differ from what \`just ${RECIPE}\` produces in"
|
||||||
echo "\`ghcr.io/edgetx/edgetx-dev:latest\`. Run \`just ${RECIPE}\` and commit the result."
|
echo "\`ghcr.io/edgetx/edgetx-dev:latest\`. Run \`just ${RECIPE}\` and commit the result."
|
||||||
@@ -102,3 +91,5 @@ runs:
|
|||||||
echo
|
echo
|
||||||
echo "</details>"
|
echo "</details>"
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|||||||
@@ -33,12 +33,17 @@ on:
|
|||||||
- 'fw.json'
|
- 'fw.json'
|
||||||
- 'web/scripts/gen-radios-json.js'
|
- 'web/scripts/gen-radios-json.js'
|
||||||
- 'web/public/radios.json'
|
- 'web/public/radios.json'
|
||||||
|
# simulator string list
|
||||||
|
- 'radio/src/translations/simstr.m4'
|
||||||
|
- 'radio/src/translations/string_list.h'
|
||||||
|
- 'radio/src/translations/sim_string_list.h'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: *trigger-paths
|
paths: *trigger-paths
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# These jobs only ever report - they must never block a contributor who does not
|
# These jobs fail on drift so it's visible on the PR, but none of them are
|
||||||
# have the local toolchain, so nothing here fails on drift.
|
# configured as required status checks - a contributor without the local
|
||||||
|
# toolchain can still merge.
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pull-requests: read
|
pull-requests: read
|
||||||
@@ -59,6 +64,7 @@ jobs:
|
|||||||
fonts: ${{ steps.filter.outputs.fonts }}
|
fonts: ${{ steps.filter.outputs.fonts }}
|
||||||
yaml: ${{ steps.filter.outputs.yaml }}
|
yaml: ${{ steps.filter.outputs.yaml }}
|
||||||
radios: ${{ steps.filter.outputs.radios }}
|
radios: ${{ steps.filter.outputs.radios }}
|
||||||
|
simstr: ${{ steps.filter.outputs.simstr }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
@@ -74,7 +80,7 @@ jobs:
|
|||||||
- name: Check the recipes this workflow calls still resolve
|
- name: Check the recipes this workflow calls still resolve
|
||||||
run: |
|
run: |
|
||||||
just --list >/dev/null
|
just --list >/dev/null
|
||||||
for recipe in cfn-sort gen-fonts gen-yaml gen-radios; do
|
for recipe in cfn-sort gen-fonts gen-yaml gen-radios gen-simstr; do
|
||||||
just --show "${recipe}" >/dev/null
|
just --show "${recipe}" >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -120,6 +126,12 @@ jobs:
|
|||||||
- 'radio/src/boards/hw_defs/**'
|
- 'radio/src/boards/hw_defs/**'
|
||||||
- 'web/scripts/gen-radios-json.js'
|
- 'web/scripts/gen-radios-json.js'
|
||||||
- 'web/public/radios.json'
|
- 'web/public/radios.json'
|
||||||
|
simstr:
|
||||||
|
- '.github/workflows/codegen_drift.yml'
|
||||||
|
- '.github/actions/codegen_drift/action.yml'
|
||||||
|
- 'radio/src/translations/simstr.m4'
|
||||||
|
- 'radio/src/translations/string_list.h'
|
||||||
|
- 'radio/src/translations/sim_string_list.h'
|
||||||
|
|
||||||
cfn-sort:
|
cfn-sort:
|
||||||
name: Custom function sort order
|
name: Custom function sort order
|
||||||
@@ -140,7 +152,6 @@ jobs:
|
|||||||
- name: Check for drift
|
- name: Check for drift
|
||||||
uses: ./.github/actions/codegen_drift
|
uses: ./.github/actions/codegen_drift
|
||||||
with:
|
with:
|
||||||
just-version: ${{ env.JUST_VERSION }}
|
|
||||||
recipe: cfn-sort
|
recipe: cfn-sort
|
||||||
paths: radio/src/cfn_sort.cpp
|
paths: radio/src/cfn_sort.cpp
|
||||||
label: Custom function sort order
|
label: Custom function sort order
|
||||||
@@ -164,7 +175,6 @@ jobs:
|
|||||||
- name: Check for drift
|
- name: Check for drift
|
||||||
uses: ./.github/actions/codegen_drift
|
uses: ./.github/actions/codegen_drift
|
||||||
with:
|
with:
|
||||||
just-version: ${{ env.JUST_VERSION }}
|
|
||||||
recipe: gen-fonts
|
recipe: gen-fonts
|
||||||
paths: radio/src/fonts/lvgl
|
paths: radio/src/fonts/lvgl
|
||||||
label: LVGL fonts
|
label: LVGL fonts
|
||||||
@@ -188,7 +198,6 @@ jobs:
|
|||||||
- name: Check for drift
|
- name: Check for drift
|
||||||
uses: ./.github/actions/codegen_drift
|
uses: ./.github/actions/codegen_drift
|
||||||
with:
|
with:
|
||||||
just-version: ${{ env.JUST_VERSION }}
|
|
||||||
recipe: gen-yaml
|
recipe: gen-yaml
|
||||||
paths: radio/src/storage/yaml
|
paths: radio/src/storage/yaml
|
||||||
label: YAML parsers
|
label: YAML parsers
|
||||||
@@ -210,7 +219,27 @@ jobs:
|
|||||||
- name: Check for drift
|
- name: Check for drift
|
||||||
uses: ./.github/actions/codegen_drift
|
uses: ./.github/actions/codegen_drift
|
||||||
with:
|
with:
|
||||||
just-version: ${{ env.JUST_VERSION }}
|
|
||||||
recipe: gen-radios
|
recipe: gen-radios
|
||||||
paths: web/public/radios.json
|
paths: web/public/radios.json
|
||||||
label: Web simulator radio list
|
label: Web simulator radio list
|
||||||
|
|
||||||
|
simstr:
|
||||||
|
name: Simulator string list
|
||||||
|
needs: changes
|
||||||
|
if: needs.changes.outputs.simstr == 'true' || github.event_name == 'workflow_dispatch'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
container:
|
||||||
|
image: ghcr.io/edgetx/edgetx-dev:latest
|
||||||
|
volumes:
|
||||||
|
- ${{ github.workspace }}:/src
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Check for drift
|
||||||
|
uses: ./.github/actions/codegen_drift
|
||||||
|
with:
|
||||||
|
recipe: gen-simstr
|
||||||
|
paths: radio/src/translations/sim_string_list.h
|
||||||
|
label: Simulator string list
|
||||||
|
|||||||
@@ -44,9 +44,15 @@ gen-yaml FLAVOR='':
|
|||||||
gen-radios:
|
gen-radios:
|
||||||
node web/scripts/gen-radios-json.js
|
node web/scripts/gen-radios-json.js
|
||||||
|
|
||||||
[doc('Regenerate the YAML parsers, LVGL fonts, cfn sort order and radio list')]
|
# Needs: m4.
|
||||||
|
[doc('Regenerate the simulator string list (radio/src/translations/sim_string_list.h)')]
|
||||||
[group('codegen')]
|
[group('codegen')]
|
||||||
codegen: gen-fonts cfn-sort gen-yaml gen-radios
|
gen-simstr:
|
||||||
|
m4 radio/src/translations/simstr.m4 radio/src/translations/string_list.h > radio/src/translations/sim_string_list.h
|
||||||
|
|
||||||
|
[doc('Regenerate the YAML parsers, LVGL fonts, cfn sort order, radio list and simulator string list')]
|
||||||
|
[group('codegen')]
|
||||||
|
codegen: gen-fonts cfn-sort gen-yaml gen-radios gen-simstr
|
||||||
|
|
||||||
[doc('Regenerate the LVGL fonts in the dev container')]
|
[doc('Regenerate the LVGL fonts in the dev container')]
|
||||||
[group('codegen (docker)')]
|
[group('codegen (docker)')]
|
||||||
@@ -72,6 +78,11 @@ docker-gen-yaml FLAVOR='':
|
|||||||
docker-gen-radios:
|
docker-gen-radios:
|
||||||
{{ _docker }} node web/scripts/gen-radios-json.js
|
{{ _docker }} node web/scripts/gen-radios-json.js
|
||||||
|
|
||||||
|
[doc('Regenerate the simulator string list in the dev container')]
|
||||||
|
[group('codegen (docker)')]
|
||||||
|
docker-gen-simstr:
|
||||||
|
{{ _docker }} m4 radio/src/translations/simstr.m4 radio/src/translations/string_list.h > radio/src/translations/sim_string_list.h
|
||||||
|
|
||||||
[doc('Regenerate everything in the dev container')]
|
[doc('Regenerate everything in the dev container')]
|
||||||
[group('codegen (docker)')]
|
[group('codegen (docker)')]
|
||||||
docker-codegen: docker-gen-fonts docker-cfn-sort docker-gen-yaml docker-gen-radios
|
docker-codegen: docker-gen-fonts docker-cfn-sort docker-gen-yaml docker-gen-radios docker-gen-simstr
|
||||||
|
|||||||
Reference in New Issue
Block a user