Keep coverage fonts optional unless a pin is requested

This commit is contained in:
skylar taylor-barrick
2026-10-26 00:20:32 +01:00
parent 6789f40242
commit 68edd37a04
2 changed files with 17 additions and 5 deletions
+12 -3
View File
@@ -88,6 +88,10 @@ jobs:
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
with:
ref: ${{ inputs.fonts-ref }}
- name: Require requested craft-fonts
if: inputs.fonts-ref != ''
shell: bash
run: echo "CRAFT_FONTS_REQUIRED=1" >> "$GITHUB_ENV"
- name: Free disk space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
- name: Install Linux build dependencies
@@ -116,7 +120,6 @@ jobs:
- name: Build instrumented test archive
env:
CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts
CRAFT_FONTS_REQUIRED: ${{ inputs.fonts-ref != '' && '1' || '' }}
CARGO_TERM_COLOR: always
# Coverage comes from instrumentation, not DWARF; debuginfo is most of target/.
CARGO_PROFILE_DEV_DEBUG: "0"
@@ -153,6 +156,10 @@ jobs:
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
with:
ref: ${{ inputs.fonts-ref }}
- name: Require requested craft-fonts
if: inputs.fonts-ref != ''
shell: bash
run: echo "CRAFT_FONTS_REQUIRED=1" >> "$GITHUB_ENV"
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
@@ -178,7 +185,6 @@ jobs:
continue-on-error: true
env:
CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts
CRAFT_FONTS_REQUIRED: ${{ inputs.fonts-ref != '' && '1' || '' }}
# Each instrumented binary writes its profile here; the scan job merges them.
LLVM_PROFILE_FILE: ${{ github.workspace }}/profraw/shard-${{ matrix.shard }}-%p-%m.profraw
run: |
@@ -234,6 +240,10 @@ jobs:
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
with:
ref: ${{ inputs.fonts-ref }}
- name: Require requested craft-fonts
if: inputs.fonts-ref != '' && steps.token.outputs.available == 'true' && inputs.shards <= 1
shell: bash
run: echo "CRAFT_FONTS_REQUIRED=1" >> "$GITHUB_ENV"
- name: Free disk space
# The instrumented workspace build overflows the ~14 GB free on a stock runner.
if: steps.token.outputs.available == 'true' && hashFiles('Cargo.toml') != '' && inputs.shards <= 1
@@ -273,7 +283,6 @@ jobs:
env:
CARGO_TERM_COLOR: always
CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts
CRAFT_FONTS_REQUIRED: ${{ inputs.fonts-ref != '' && '1' || '' }}
# Coverage comes from instrumentation, not DWARF; debuginfo is most of target/.
CARGO_PROFILE_DEV_DEBUG: "0"
run: >
+5 -2
View File
@@ -96,8 +96,11 @@ class SonarCloudTests(unittest.TestCase):
self.assertLess(steps.index(checkout), steps.index(runner))
self.assertEqual(checkout['with']['ref'], '${{ inputs.fonts-ref }}')
self.assertEqual(runner['env']['CRAFT_FONTS_DIR'], '${{ github.workspace }}/craft-fonts')
self.assertEqual(runner['env']['CRAFT_FONTS_REQUIRED'],
"${{ inputs.fonts-ref != '' && '1' || '' }}")
self.assertNotIn('CRAFT_FONTS_REQUIRED', runner['env'])
required = next(step for step in steps if step.get('name') == 'Require requested craft-fonts')
self.assertLess(steps.index(required), steps.index(runner))
self.assertTrue(required['if'].startswith("inputs.fonts-ref != ''"))
self.assertEqual(required['run'], 'echo "CRAFT_FONTS_REQUIRED=1" >> "$GITHUB_ENV"')
def test_pdf_fixture_setup_runs_before_both_test_runners(self):
workflow = yaml.load(