Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: Release Build

on:
workflow_dispatch:
inputs:
release_id:
description: "Optional release tag. Defaults to a dated GitHub Actions tag."
required: false
type: string
source_url:
description: "Source U.S. PBF URL"
required: false
default: "https://download.geofabrik.de/north-america/us-latest.osm.pbf"
type: string
publish:
description: "Publish the built assets as a GitHub release"
required: false
default: false
type: boolean
pull_request:
branches: ["main"]
paths:
- ".github/workflows/release-build.yml"
- "bin/lib.sh"
- "schema/bootstrap.sql"
- "schema/derive.sql"
- "schema/osm2pgsql/openinterstate.lua"
- "tooling/**"

permissions:
contents: write

concurrency:
group: release-build-${{ github.ref }}
cancel-in-progress: false

jobs:
prefilter:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
release_id: ${{ steps.meta.outputs.release_id }}
source_url: ${{ steps.meta.outputs.source_url }}
filtered_filename: ${{ steps.meta.outputs.filtered_filename }}
steps:
- uses: actions/checkout@v4

- name: Resolve release metadata
id: meta
shell: bash
env:
RELEASE_INPUT: ${{ inputs.release_id || '' }}
SOURCE_URL_INPUT: ${{ inputs.source_url || 'https://download.geofabrik.de/north-america/us-latest.osm.pbf' }}
run: |
release_input="$RELEASE_INPUT"
if [[ -n "$release_input" ]]; then
release_id="$release_input"
else
release_id="release-$(date -u +%F)-gha-${GITHUB_RUN_NUMBER}"
fi
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
source_url="https://download.geofabrik.de/north-america/us/rhode-island-latest.osm.pbf"
else
source_url="$SOURCE_URL_INPUT"
fi
source_basename="$(basename "$source_url")"
filtered_filename="${source_basename%.osm.pbf}.canonical-filtered.osm.pbf"
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
echo "source_url=$source_url" >> "$GITHUB_OUTPUT"
echo "filtered_filename=$filtered_filename" >> "$GITHUB_OUTPUT"

- name: Show disk budget
run: df -h .

- name: Install prefilter dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends osmium-tool

- name: Stream and filter the source PBF
run: |
mkdir -p ci-inputs
tooling/ci/prefilter_stream.sh \
--source-url "${{ steps.meta.outputs.source_url }}" \
--output-pbf "$PWD/ci-inputs/${{ steps.meta.outputs.filtered_filename }}" \
--source-metadata-file "$PWD/ci-inputs/source-pbf-metadata.json"

- name: Upload filtered build inputs
uses: actions/upload-artifact@v4
with:
name: prefiltered-${{ steps.meta.outputs.release_id }}
path: |
ci-inputs/${{ steps.meta.outputs.filtered_filename }}
ci-inputs/source-pbf-metadata.json
retention-days: 1
compression-level: 0

build-release:
needs: prefilter
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Show disk budget
run: df -h .

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends osm2pgsql postgresql-client

- name: Install tooling Python dependencies
run: |
python -m venv "$RUNNER_TEMP/openinterstate-venv"
"$RUNNER_TEMP/openinterstate-venv/bin/pip" install --upgrade pip
"$RUNNER_TEMP/openinterstate-venv/bin/pip" install -r tooling/requirements.txt
echo "$RUNNER_TEMP/openinterstate-venv/bin" >> "$GITHUB_PATH"

- name: Download filtered build inputs
uses: actions/download-artifact@v4
with:
name: prefiltered-${{ needs.prefilter.outputs.release_id }}
path: ci-inputs

- name: Build release from filtered artifact
env:
CARGO_TARGET_DIR: ${{ runner.temp }}/cargo-target
run: |
mkdir -p ci-artifacts/releases
tooling/ci/build_release_host.sh \
--release-id "${{ needs.prefilter.outputs.release_id }}" \
--filtered-pbf-file "$PWD/ci-inputs/${{ needs.prefilter.outputs.filtered_filename }}" \
--source-pbf-metadata-file "$PWD/ci-inputs/source-pbf-metadata.json" \
--source-url "${{ needs.prefilter.outputs.source_url }}" \
--output-root "$PWD/ci-artifacts/releases" \
--work-dir "$RUNNER_TEMP/openinterstate-release-build"

- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: release-${{ needs.prefilter.outputs.release_id }}
path: |
ci-artifacts/releases/${{ needs.prefilter.outputs.release_id }}
ci-artifacts/releases/openinterstate-${{ needs.prefilter.outputs.release_id }}.tar.gz
retention-days: 7
compression-level: 0

publish:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
needs: [prefilter, build-release]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

- name: Download release bundle
uses: actions/download-artifact@v4
with:
name: release-${{ needs.prefilter.outputs.release_id }}
path: release-output

- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
tooling/ci/publish_release.sh \
--release-id "${{ needs.prefilter.outputs.release_id }}" \
--release-dir "$PWD/release-output/${{ needs.prefilter.outputs.release_id }}" \
--archive-file "$PWD/release-output/openinterstate-${{ needs.prefilter.outputs.release_id }}.tar.gz"
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ motorway/trunk road context and POI data needed for Interstate derivation, and
the downstream Rust graph builders stay focused on Interstate-labeled corridors
instead of constructing a much broader national highway graph.

## GitHub Actions Release Build

The repo now carries a manual GitHub Actions release workflow at
`.github/workflows/release-build.yml`.

That workflow is shaped to fit standard public GitHub-hosted runners:

1. download the raw `us-latest.osm.pbf` into short-lived runner storage
2. upload only the filtered `~160 MB` import PBF plus source metadata
3. rebuild PostGIS, derive tables, and export the release from that artifact
4. optionally publish the archive, manifest, checksums, and source lineage to GitHub

The raw source PBF is deleted after filtering and is never published as an
artifact, so the persisted handoff between jobs stays small even though the
prefilter job uses temporary local disk.

The manual `workflow_dispatch` path targets the full U.S. source file. The
`pull_request` path uses a smaller Rhode Island smoke-test extract so PR checks
validate the workflow mechanics without paying the full release-build cost on
every iteration.

## Repo Map

- `bin/`: the local command-line entrypoint
Expand Down
30 changes: 17 additions & 13 deletions bin/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,22 @@ oi_download_pbf() {
printf '%s\n' "$resolved_output"
}

oi_canonical_filter_args() {
cat <<'EOF'
n/highway=motorway_junction
n/amenity=fuel,restaurant,fast_food,cafe,toilets,charging_station
n/tourism=hotel,motel,guest_house
n/shop=gas
n/cuisine
n/highway=rest_area,services
w/highway=motorway,motorway_link,trunk,trunk_link,rest_area,services
w/amenity=fuel,restaurant,fast_food,cafe,toilets,charging_station
w/tourism=hotel,motel,guest_house
w/shop=gas
w/cuisine
EOF
}

oi_filter_pbf() {
local input_pbf="$1"
local output_pbf="$2"
Expand All @@ -421,19 +437,7 @@ oi_filter_pbf() {
fi

mkdir -p "$(dirname "$output_pbf")"
filter_args=(
n/highway=motorway_junction
n/amenity=fuel,restaurant,fast_food,cafe,toilets,charging_station
n/tourism=hotel,motel,guest_house
n/shop=gas
n/cuisine
n/highway=rest_area,services
w/highway=motorway,motorway_link,trunk,trunk_link,rest_area,services
w/amenity=fuel,restaurant,fast_food,cafe,toilets,charging_station
w/tourism=hotel,motel,guest_house
w/shop=gas
w/cuisine
)
mapfile -t filter_args < <(oi_canonical_filter_args)
state_file="$(oi_state_file filter "$output_pbf")"
expected_signature="$(
{
Expand Down
29 changes: 26 additions & 3 deletions docs/release_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ Cargo and runner caches now default under the managed data root as well, so a
goose-drive workspace keeps both data artifacts and Rust build cache off the
main disk.

## GitHub Actions Workflow

The repo also includes a manual GitHub Actions workflow at
`.github/workflows/release-build.yml`.

That workflow is designed for standard public GitHub-hosted runners:

1. download the raw U.S. PBF into temporary runner storage
2. persist only the filtered canonical import PBF plus source metadata as an artifact
3. rebuild PostGIS, derive product tables, and export the release from that filtered artifact
4. optionally publish the archive and companion metadata files to GitHub Releases

The raw source file is deleted after filtering and is never passed between jobs
as an artifact. The only persisted handoff is the filtered canonical import PBF
plus its source metadata.

The manual `workflow_dispatch` run uses the full U.S. source by default. The
`pull_request` trigger is intentionally lighter and uses a Rhode Island smoke
test extract so release-workflow changes can be validated quickly in PRs.

## Environment Setup

The default local workflow works without any env file and stores working data in
Expand Down Expand Up @@ -132,18 +152,21 @@ GeoParquet packaging can follow later.

Every release now records:

1. the raw source PBF path, size, modified time, and SHA-256
1. the raw source PBF path or streamed source URL, plus size, modified time, and SHA-256
2. the imported canonical filtered PBF path, size, modified time, and SHA-256
3. the source download URL when provided
4. the derivation chain used to produce the release

This lineage is published both inside `manifest.json` and as the standalone
asset `source_lineage.json`.

When the GitHub Actions workflow streams the raw source instead of storing it on
disk, `source_pbf.path` is recorded as the downloaded source URL.

## Published Standalone Release

The current standalone release is published as:

1. GitHub release tag: `release-2026-03-12-goose-rerun-branchfix`
2. archive: `openinterstate-release-2026-03-12-goose-rerun-branchfix.tar.gz`
1. GitHub release tag: `release-2026-03-12-coldpath`
2. archive: `openinterstate-release-2026-03-12-coldpath.tar.gz`
3. companion files: `manifest.json`, `source_lineage.json`, and `checksums.txt`
Loading
Loading