forked from ChelseaKR/gtfs-scorecard
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.85 KB
/
Copy pathtiles.yml
File metadata and controls
77 lines (66 loc) · 2.85 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
73
74
75
76
77
name: National route tiles
# Rebuild the national all-routes PMTiles archive (web/tiles/national-routes.pmtiles).
#
# tippecanoe is NOT in the daily render image, so this is deliberately a manual,
# on-demand workflow: it never runs on the daily cron and so cannot break the
# daily Pages deploy. Trigger it from the Actions tab after the per-agency route
# geometry has changed enough to be worth re-tiling. See docs/decisions/0023.
on:
workflow_dispatch:
inputs:
commit:
description: "Commit the rebuilt archive back to the branch"
type: boolean
default: true
permissions:
contents: write
jobs:
build-tiles:
runs-on: ubuntu-latest
steps:
# zizmor(artipacked): this checkout's persisted credential is what the
# later `git push` (committing the rebuilt PMTiles archive) uses.
# Needs to stay persisted.
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Build tippecanoe from a pinned source tag
run: |
set -euo pipefail
git clone --depth 1 --branch 2.78.0 https://github.com/felt/tippecanoe.git /tmp/tippecanoe
make -C /tmp/tippecanoe -j2
sudo make -C /tmp/tippecanoe install
tippecanoe --version
- uses: astral-sh/setup-uv@eb1897b8dc4b5d5bfe39a428a8f2304605e0983c # v7.0.0
with:
python-version: "3.12"
- name: Install the pipeline
working-directory: pipeline
run: uv sync --locked
- name: Aggregate routes and build the PMTiles archive
working-directory: pipeline
run: uv run python scripts/build_national_pmtiles.py
- name: Report archive size
run: |
ls -lh web/tiles/national-routes.pmtiles
SIZE=$(stat -c%s web/tiles/national-routes.pmtiles)
echo "Archive is $SIZE bytes. Threshold for committing to web/ is 25 MB (ADR 0023)."
if [ "$SIZE" -gt 26214400 ]; then
echo "::warning title=tiles too large::Archive exceeds 25 MB; move it to S3+CloudFront per ADR 0023 instead of committing."
fi
- name: Upload archive as a workflow artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: national-routes-pmtiles
path: web/tiles/national-routes.pmtiles
- name: Commit the rebuilt archive
if: ${{ inputs.commit }}
run: |
set -euo pipefail
if git diff --quiet -- web/tiles/national-routes.pmtiles; then
echo "Archive unchanged; nothing to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add web/tiles/national-routes.pmtiles
git commit -m "chore(tiles): rebuild national-routes PMTiles archive"
git push