Files
OpenAirframes/.github/workflows/registry-source.yaml
T
Ashley Childress 0a0a2855f3 fix: require an explicit opt-in before rebuilding a source from one day
FileNotFoundError means no recent release carries the asset, which is not the same as the
source never having published: a rate limit or a run of releases missing the asset reaches
the same branch and would erase the accumulated history.

- add --allow-bootstrap; without it a missing asset is now a hard failure
- plumb it through the reusable workflow, and set it for Transport Canada only, which has
  genuinely never published
- let a tolerated source that produced nothing upload nothing, rather than failing its leg
  and blocking the join a required source depends on

Generated-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 11:06:51 -04:00

105 lines
3.9 KiB
YAML

name: registry-source
# One registry source, on its own thread. Called once per entry in the caller's matrix, so
# adding a registry is a matrix entry plus src/create_daily_<source>_release.py — no new job.
on:
workflow_call:
inputs:
source:
description: 'Source id; must match src/create_daily_<source>_release.py'
required: true
type: string
date:
description: 'Date to process (YYYY-MM-DD, default: today UTC)'
required: false
type: string
python-version:
required: false
type: string
default: '3.14'
required:
description: 'Fail the thread when this source cannot be built'
required: false
type: boolean
default: false
allow_bootstrap:
description: 'Onboarding only: permit a single-day rebuild when no asset has ever been published'
required: false
type: boolean
default: false
# Keyed on the source: without it every matrix leg shares one group and the legs cancel
# each other, which is the opposite of running them in parallel.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.source }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04-arm
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Deliberately outside the tolerated step below: a typo in the matrix is a config
# error, and must go red even for an optional source.
- name: Check the source has a build script
env:
SOURCE: ${{ inputs.source }}
run: |
script="src/create_daily_${SOURCE}_release.py"
if [ ! -f "$script" ]; then
echo "::error title=Unknown registry source::$script does not exist"
exit 1
fi
- name: Build ${{ inputs.source }} registry
continue-on-error: ${{ inputs.required == false }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE: ${{ inputs.source }}
RUN_DATE: ${{ inputs.date }}
BOOTSTRAP: ${{ inputs.allow_bootstrap && '1' || '' }}
run: |
python "src/create_daily_${SOURCE}_release.py" ${RUN_DATE:+--date "$RUN_DATE"} ${BOOTSTRAP:+--allow-bootstrap}
# Stage into one directory so every leg's artifact has the same root; a second
# search path would move the root to the common ancestor for some legs only.
shopt -s nullglob
built=(data/openairframes/openairframes_"${SOURCE}"_*.csv)
if [ ${#built[@]} -ne 1 ]; then
echo "::error title=${SOURCE} produced no registry CSV::expected one openairframes_${SOURCE}_*.csv, found ${#built[@]}"
exit 1
fi
# Stage into one directory so every leg's artifact has the same root; a second
# search path would move the root to the common ancestor for some legs only.
mkdir -p data/registry-out
cp "${built[@]}" data/registry-out/
cp data/faa_releasable/ReleasableAircraft_*.zip data/registry-out/ 2>/dev/null || true
ls -lah data/registry-out
- name: Upload ${{ inputs.source }} registry
uses: actions/upload-artifact@v7
with:
name: registry-${{ inputs.source }}
path: data/registry-out
retention-days: 1
# A tolerated source that failed has nothing to upload; only a required
# source missing its artifact is an error.
if-no-files-found: ${{ inputs.required && 'error' || 'ignore' }}