forked from ChelseaKR/gtfs-scorecard
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (68 loc) · 3.32 KB
/
Copy pathci.yml
File metadata and controls
72 lines (68 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
# Cancel superseded runs on the same ref (new push to a PR) to save minutes.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
pipeline:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pipeline
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@eb1897b8dc4b5d5bfe39a428a8f2304605e0983c # v7.0.0
with:
python-version: "3.12"
- run: uv sync --locked
# CICD-27/OBS-22 parity: CI runs the exact same merge-blocking gate a
# contributor runs locally (`make verify`), not a hand-copied subset of
# its steps that can drift from the Makefile. See the root Makefile for
# what this covers: lint, format, mypy, tests+coverage, contrast,
# readability, version-agreement, no-bare-TODO.
- run: make -C .. verify
# Registry hygiene gate. The feed-descriptor-name backlog cleared with
# the registry dedupe, so --strict now blocks any regression; the
# remaining non-blocking kinds (non-HTTPS URLs, missing mdb_ids) still
# print as the report.
- run: uv run scorecard lint --strict
# CQ-10's missing half: the package must actually build as a wheel on
# every PR, not just declare a hatchling backend.
- run: uv build --wheel
# Import and dispatch from the built artifact, not the editable checkout.
# This catches package-data omissions in Marketplace/uvx installations.
- run: uvx --from dist/scorecard_pipeline-*.whl scorecard --help
- name: Verify packaged data and sync receipt contract
run: |
wheel="$(pwd)/$(find dist -name 'scorecard_pipeline-*.whl' -print -quit)"
isolated="$(mktemp -d)"
uv venv "$isolated/venv"
uv pip install --python "$isolated/venv/bin/python" "$wheel"
cd "$isolated"
"$isolated/venv/bin/python" -c \
"from scorecard_pipeline.jurisdictions import JURISDICTIONS; assert len(JURISDICTIONS.countries) == 249; assert JURISDICTIONS.countries['JP'].subdivisions['JP-13'] == 'Tokyo'"
mkdir -p "$isolated/root"
printf '%s\n' \
'agencies:' \
' - id: fixture-agency' \
' name: Fixture Agency' \
' static_gtfs_url: https://tracked.example.org/gtfs.zip' \
> "$isolated/root/agencies.yaml"
printf '%s\n' \
'id,data_type,entity_type,location.country_code,provider,is_official,static_reference,urls.direct_download,urls.authentication_type,status' \
'mdb-test,gtfs,,US,Test Transit,true,,https://example.org/gtfs.zip,0,active' \
> "$isolated/feeds_v2.csv"
SCORECARD_ROOT="$isolated/root" "$isolated/venv/bin/scorecard" sync \
--catalog "$isolated/feeds_v2.csv" \
--out "$isolated/proposals.yaml" \
--source-metadata-out "$isolated/source-metadata.json"
"$isolated/venv/bin/python" -c \
"import json, pathlib; receipt=json.loads(pathlib.Path('$isolated/source-metadata.json').read_text()); assert receipt['schema_version'] == '1.2'; assert receipt['schema_url'].endswith('sync-source-metadata-1.2.schema.json')"