Skip to content

build-and-release

build-and-release #418

'on':
workflow_dispatch: ~
schedule:
- cron: 25 5 * * 1
name: build-and-release
jobs:
build_pfaedle:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
repository: stupidpupil/pfaedle
submodules: yes
path: pfaedle
ref: macos-patches
- name: Get pfaedle ref
id: pfaedle-ref
run: |
echo "ref=$(git -C pfaedle rev-parse HEAD)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pfaedle-build
id: cache_pfaedle_build
uses: actions/cache@v4
with:
path: |
pfaedle-build
key: ${{ runner.os }}-${{ steps.pfaedle-ref.outputs.ref }}-v3
- name: Build pfaedle
if: steps.cache_pfaedle_build.outputs.cache-hit != 'true'
run: |
cd pfaedle
mkdir build
cd build
cmake ..
make -j
make install DESTDIR="../../pfaedle-build"
cd ../../
chmod -R ug+rw pfaedle-build/
shell: bash
- name: Upload pfaedle artefact
uses: actions/upload-artifact@v4
with:
name: pfaedle
path: pfaedle-build
if-no-files-found: error
build_osrm:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
repository: 'Project-OSRM/osrm-backend'
path: 'osrm-backend'
ref: '204fdaff6e83fe336db74a84db5adb3320a9a3ed'
- name: Get osrm-backend ref
id: osrm-backend-ref
run: |
echo "ref=$(git -C osrm-backend rev-parse HEAD)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache osrm-backend/build
id: cache_osrm_backend_build
uses: actions/cache@v4
with:
path: |
osrm-backend/build
osrm-backend/mason_packages
key: ${{ runner.os }}-${{ steps.osrm-backend-ref.outputs.ref }}-osrm-v2
- name: Build osrm-backend
if: steps.cache_osrm_backend_build.outputs.cache-hit != 'true'
run: |
cd osrm-backend
rm -rf build
mkdir build
cd build
cmake ../ -DENABLE_MASON=1
make
cd ../../
shell: bash
- name: Clean osrm-backend
run: |
rm -rf osrm-backend/build/CMakeFiles
rm -rf osrm-backend/build/libosrm*
rm -rf osrm-backend/build/flatbuffers-build
rm -rf osrm-backend/mason_packages/headers/
rm -rf osrm-backend/mason_packages/.binaries/
rm -rf osrm-backend/third_party/
rm -rf osrm-backend/unit_tests/
rm -rf osrm-backend/src/
rm -rf osrm-backend/docs/
rm -rf osrm-backend/features/
rm -rf osrm-backend/include/
rm -rf osrm-backend/test/
rm -rf osrm-backend/.git
rm -rf osrm-backend/.github
find osrm-backend -name "*.c" -type f -delete
find osrm-backend -name "*.cc" -type f -delete
find osrm-backend -name "*.h" -type f -delete
find osrm-backend -name "*.cpp" -type f -delete
find osrm-backend -name "*.hpp" -type f -delete
find osrm-backend -name "*.py" -type f -delete
find osrm-backend -name "*.md" -type f -delete
find osrm-backend -name "*.rst" -type f -delete
find osrm-backend -name "*.txt" -type f -delete
find osrm-backend -name "*.pbf" -type f -delete
find osrm-backend -name "*.rs" -type f -delete
find osrm-backend -name "*.png" -type f -delete
find osrm-backend -name "*.jpg" -type f -delete
shell: bash
- name: Upload osrm artefact
uses: actions/upload-artifact@v4
with:
name: osrm
path: osrm-backend
if-no-files-found: error
download_and_prepare_terrain:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Get Terrain 50 md5
id: terrain50_md5
run: |
echo "md5=$(curl "https://api.os.uk/downloads/v1/products/Terrain50/downloads" | jq '.[0].md5')" >> $GITHUB_OUTPUT
- name: Cache Terrain 50
id: cache_terrain50
uses: actions/cache@v4
with:
path: |
output/*terr50*
key: ${{ steps.terrain50_md5.outputs.md5 }}-${{ hashFiles('config.yml') }}-terr50-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_terrain50.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_terrain50.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_terrain50.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_terrain50.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_terrain50.outputs.cache-hit != 'true'
- name: Download terrain
if: steps.cache_terrain50.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_terrain50()
shell: Rscript {0}
- name: Prepare_terrain
if: steps.cache_terrain50.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_terrain50()
shell: Rscript {0}
- name: Upload Terrain 50 artifact
uses: actions/upload-artifact@v4
with:
name: terr50.tif
path: output/*terr50*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
download_and_prepare_osm:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Get Geofabrik ETag
id: geofabrik_etag
run: |
echo "etag=$(curl -I "https://download.geofabrik.de/europe/great-britain-latest.osm.pbf" | grep "ETag")" >> $GITHUB_OUTPUT
- name: Cache OSM
id: cache_osm
uses: actions/cache@v4
with:
path: |
output/openstreetmap/*
key: ${{ steps.geofabrik_etag.outputs.etag }}-${{ hashFiles('config.yml')
}}-osm-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_osm.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_osm.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_osm.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_osm.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_osm.outputs.cache-hit != 'true'
- name: Install osmium
run: brew install osmium-tool
if: steps.cache_osm.outputs.cache-hit != 'true'
- name: Download and prepare OSM
if: steps.cache_osm.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_and_prepare_osm()
shell: Rscript {0}
- name: Upload OpenStreetMap artifact
uses: actions/upload-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
prepare_street_graph:
needs:
- download_and_prepare_terrain
- download_and_prepare_osm
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Download OpenStreetMap artifact
uses: actions/download-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/
- name: Download Terrain 50 artifact
uses: actions/download-artifact@v4
with:
name: terr50.tif
path: output
- name: Derive hash from ParochialCacheKeys
id: parochial_cache_keys
run: |-
echo "hash=$(
ls output/*/*.meta.json output/*.meta.json | sort | xargs jq .ParochialCacheKey | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache street graph
id: cache_street_graph
uses: actions/cache@v4
with:
path: output/opentripplanner/streetGraph.obj*
key: ${{ hashFiles('config.yml') }}-${{ steps.parochial_cache_keys.outputs.hash
}}-otp.street-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Download OTP
if: steps.cache_street_graph.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_otp()
shell: Rscript {0}
- name: Cache OTP elevation lookups
if: steps.cache_street_graph.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: data-raw/otp_cache/*
key: ${{ hashFiles('output/*terr50*') }}
- name: Install Java 21
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '21'
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Prepare street graph
if: steps.cache_street_graph.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_street_graph()
shell: Rscript {0}
- name: Upload street graph artifact
uses: actions/upload-artifact@v4
with:
name: streetGraph.obj
path: output/opentripplanner/streetGraph.obj*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
prepare_osrm_graph:
needs:
- build_osrm
- download_and_prepare_osm
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Download OpenStreetMap artifact
uses: actions/download-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/
- name: Download osrm artifact
uses: actions/download-artifact@v4
with:
name: osrm
path: osrm-backend
- name: Make osrm executable
run: |
chmod ug+x $GITHUB_WORKSPACE/osrm-backend/build/osrm-*
- name: Add osrm to path
run: echo "$GITHUB_WORKSPACE/osrm-backend/build" >> $GITHUB_PATH
- name: Derive hash from ParochialCacheKeys
id: parochial_cache_keys
run: |-
echo "hash=$(
ls output/*/*.meta.json output/*.meta.json | sort | xargs jq .ParochialCacheKey | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache OSRM graph
id: cache_street_graph
uses: actions/cache@v4
with:
path: output/osrm_driving/*
key: ${{ hashFiles('config.yml') }}-${{ steps.parochial_cache_keys.outputs.hash
}}-osrm_driving-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_street_graph.outputs.cache-hit != 'true'
- name: Prepare osrm graph
if: steps.cache_street_graph.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_osrm_graph()
shell: Rscript {0}
- name: Upload osrm outputs artifact
uses: actions/upload-artifact@v4
with:
name: osrm-graph
path: output/osrm_driving/*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
download_and_prepare_atoc:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
- name: Get ATOC URL
id: atoc_url
run: |
devtools::load_all()
cat(paste0("url=", get_atoc_download_url(),"\n"), file=Sys.getenv("GITHUB_OUTPUT"))
shell: Rscript {0}
- name: Cache ATOC
id: cache_atoc
uses: actions/cache@v4
with:
path: |
output/gtfs/atoc.*.gtfs.zip*
key: ${{ steps.atoc_url.outputs.url }}-${{ hashFiles('config.yml') }}-atoc.gtfs-v1
- name: Download and prepare ATOC GTFS
if: steps.cache_atoc.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_atoc()
prepare_atoc_gtfs() |>
parochial:::summarise_gtfs_as_markdown() |>
cat(file=Sys.getenv("GITHUB_STEP_SUMMARY"))
shell: Rscript {0}
- name: Upload ATOC GTFS artifact
uses: actions/upload-artifact@v4
with:
name: atoc.gtfs.zip
path: output/gtfs/atoc.*.gtfs.zip*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
download_and_prepare_tnds:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Get TNDS directory listing hash
id: tnds_dir_list_hash
run: |
echo "hash=$(
curl -s ftp://$TNDS_USERNAME:[email protected] | sort | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache TNDS
id: cache_tnds
uses: actions/cache@v4
with:
path: |
output/gtfs/*.tnds.*.gtfs.zip*
key: ${{ steps.tnds_dir_list_hash.outputs.hash }}-${{ hashFiles('config.yml')
}}-tnds.gtfs-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_tnds.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_tnds.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_tnds.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_tnds.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_tnds.outputs.cache-hit != 'true'
- name: Download and prepare TNDS GTFS
if: steps.cache_tnds.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_tnds()
prepare_tnds_gtfs() |>
parochial:::summarise_gtfs_as_markdown() |>
cat(file=Sys.getenv("GITHUB_STEP_SUMMARY"))
shell: Rscript {0}
- name: Upload TNDS GTFS artifact
uses: actions/upload-artifact@v4
with:
name: tnds.gtfs.zip
path: output/gtfs/*.tnds.*.gtfs.zip*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
download_and_prepare_bods:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Get BODS index page hash
id: bods_index_page_hash
run: |
echo "hash=$(curl "https://data.bus-data.dft.gov.uk/timetable/" | md5)" >> $GITHUB_OUTPUT
- name: Cache BODS
id: cache_bods
uses: actions/cache@v4
with:
path: output/gtfs/*.bods.*.gtfs.zip*
key: ${{ steps.bods_index_page_hash.outputs.hash }}-${{ hashFiles('config.yml')
}}-bods.gtfs-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_bods.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_bods.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_bods.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_bods.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_bods.outputs.cache-hit != 'true'
- name: Download and prepare BODS GTFS
if: steps.cache_bods.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_and_prepare_bods_gtfs() |>
parochial:::summarise_gtfs_as_markdown() |>
cat(file=Sys.getenv("GITHUB_STEP_SUMMARY"))
shell: Rscript {0}
- name: Upload BODS GTFS artifact
uses: actions/upload-artifact@v4
with:
name: bods.gtfs.zip
path: output/gtfs/*.bods.*.gtfs.zip*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
merge_and_pfaedle_gtfs:
needs:
- download_and_prepare_atoc
- download_and_prepare_tnds
- download_and_prepare_bods
- download_and_prepare_osm
- build_pfaedle
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Download ATOC GTFS artifact
uses: actions/download-artifact@v4
with:
name: atoc.gtfs.zip
path: output/gtfs
- name: Download TNDS GTFS artifact
uses: actions/download-artifact@v4
with:
name: tnds.gtfs.zip
path: output/gtfs
- name: Download BODS GTFS artifact
uses: actions/download-artifact@v4
with:
name: bods.gtfs.zip
path: output/gtfs
- name: Download OpenStreetMap artifact
uses: actions/download-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/
- name: Derive hash from ParochialCacheKeys
id: parochial_cache_keys
run: |-
echo "hash=$(
ls output/*/*.meta.json output/*.meta.json | sort | xargs jq .ParochialCacheKey | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache Merged GTFS
id: cache_merged_gtfs
uses: actions/cache@v4
with:
path: |
output/gtfs/merged.*.gtfs.zip*
key: ${{ hashFiles('config.yml') }}-${{ steps.parochial_cache_keys.outputs.hash
}}-merged.gtfs-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Install osmium
run: brew install osmium-tool
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Download pfaedle artifact
uses: actions/download-artifact@v4
with:
name: pfaedle
path: pfaedle-build
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Make pfaedle executable
run: |
chmod ug+x $GITHUB_WORKSPACE/pfaedle-build/usr/local/bin/*
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Add pfaedle to path
run: echo "$GITHUB_WORKSPACE/pfaedle-build/usr/local/bin" >> $GITHUB_PATH
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- uses: actions/setup-go@v5
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
with:
go-version: 'stable'
- name: Get gtfstidy
run: go install github.com/patrickbr/gtfstidy@25d4d6d1079a5926d9a558546bbe36d5b4cdb45f
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
- name: Merge and Pfaedle Merged GTFS
if: steps.cache_merged_gtfs.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_merged_gtfs(should_pfaedle = TRUE)
shell: Rscript {0}
- name: Upload Merged GTFS artifact
uses: actions/upload-artifact@v4
with:
name: merged.gtfs.zip
path: output/gtfs/merged.*.gtfs.zip*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
prepare_pretty_map:
needs: merge_and_pfaedle_gtfs
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
- name: Download Merged GTFS artifact
uses: actions/download-artifact@v4
with:
name: merged.gtfs.zip
path: output/gtfs
- name: Prepare map
run: |
devtools::load_all()
prepare_pretty_map()
shell: Rscript {0}
- name: Upload map artifact
uses: actions/upload-artifact@v4
with:
name: map.png
path: output/map*.png*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
prepare_final_graph:
needs:
- download_and_prepare_osm
- prepare_street_graph
- merge_and_pfaedle_gtfs
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Download Merged GTFS artifact
uses: actions/download-artifact@v4
with:
name: merged.gtfs.zip
path: output/gtfs
- name: Download street graph artifact
uses: actions/download-artifact@v4
with:
name: streetGraph.obj
path: output/opentripplanner
- name: Derive hash from ParochialCacheKeys
id: parochial_cache_keys
run: |-
echo "hash=$(
ls output/*/*.meta.json output/*.meta.json | sort | xargs jq .ParochialCacheKey | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache transport graph
id: cache_transport_graph
uses: actions/cache@v4
with:
path: |
output/opentripplanner/graph.obj*
output/**/*.meta.json
key: ${{ hashFiles('config.yml') }}-${{ steps.parochial_cache_keys.outputs.hash
}}-otp.final-v1
- uses: r-lib/actions/setup-r@v2
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- name: Download OTP
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
run: |
devtools::load_all()
download_otp()
shell: Rscript {0}
- name: Install Java 21
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '21'
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
- name: Prepare transport graph
if: steps.cache_transport_graph.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_transport_graph()
shell: Rscript {0}
- name: Upload transport graph artifact
uses: actions/upload-artifact@v4
with:
name: graph.obj
path: output/opentripplanner/graph.obj*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
prepare_r5r_network_dat:
needs:
- download_and_prepare_osm
- merge_and_pfaedle_gtfs
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Download OpenStreetMap artifact
uses: actions/download-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/
- name: Download Merged GTFS artifact
uses: actions/download-artifact@v4
with:
name: merged.gtfs.zip
path: output/gtfs
- name: Derive hash from ParochialCacheKeys
id: parochial_cache_keys
run: |-
echo "hash=$(
ls output/*/*.meta.json output/*.meta.json | sort | xargs jq .ParochialCacheKey | shasum -a 1
)" >> $GITHUB_OUTPUT
- name: Cache r5r network.dat
id: cache_network_dat
uses: actions/cache@v4
with:
path: |
output/r5r/network.dat*
key: ${{ hashFiles('config.yml') }}-${{ steps.parochial_cache_keys.outputs.hash
}}-r5r-v2
- uses: r-lib/actions/setup-r@v2
if: steps.cache_network_dat.outputs.cache-hit != 'true'
- uses: r-lib/actions/setup-pandoc@v2
if: steps.cache_network_dat.outputs.cache-hit != 'true'
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
if: steps.cache_network_dat.outputs.cache-hit != 'true'
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
if: steps.cache_network_dat.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE)
shell: Rscript {0}
if: steps.cache_network_dat.outputs.cache-hit != 'true'
- name: Install Java 21
if: steps.cache_network_dat.outputs.cache-hit != 'true'
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '21'
- name: Prepare r5r network.dat
if: steps.cache_network_dat.outputs.cache-hit != 'true'
run: |
devtools::load_all()
prepare_r5r_network_dat()
shell: Rscript {0}
- name: Upload r5r network.dat artifact
uses: actions/upload-artifact@v4
with:
name: network.dat
path: output/r5r/network.dat*
if-no-files-found: error
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}
release:
needs:
- prepare_r5r_network_dat
- prepare_osrm_graph
- prepare_pretty_map
- prepare_final_graph
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Write config.yml
uses: DamianReeves/[email protected]
with:
path: ${{ github.workspace }}/config.yml
contents: |
default:
atoc_username: !expr Sys.getenv("ATOC_USERNAME")
atoc_password: !expr Sys.getenv("ATOC_PASSWORD")
tnds_username: !expr Sys.getenv("TNDS_USERNAME")
tnds_password: !expr Sys.getenv("TNDS_PASSWORD")
output_affix: !expr Sys.getenv("OUTPUT_AFFIX")
bounds: !expr Sys.getenv("BOUNDS")
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds')
}}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install dependencies
run: |
install.packages(c("devtools"))
devtools::install_deps(dependencies = TRUE, type = "binary")
shell: Rscript {0}
- name: Install Java 21
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '21'
- name: Download OTP
run: |
devtools::load_all()
download_otp()
shell: Rscript {0}
- name: Download Terrrain 50 artifact
uses: actions/download-artifact@v4
with:
name: terr50.tif
path: output
- name: Download OpenStreetMap artifact
uses: actions/download-artifact@v4
with:
name: openstreetmap
path: output/openstreetmap/
- name: Download ATOC GTFS artifact
uses: actions/download-artifact@v4
with:
name: atoc.gtfs.zip
path: output/gtfs
- name: Download TNDS GTFS artifact
uses: actions/download-artifact@v4
with:
name: tnds.gtfs.zip
path: output/gtfs
- name: Download BODS GTFS artifact
uses: actions/download-artifact@v4
with:
name: bods.gtfs.zip
path: output/gtfs
- name: Download Merged GTFS artifact
uses: actions/download-artifact@v4
with:
name: merged.gtfs.zip
path: output/gtfs
- name: Download street graph artifact
uses: actions/download-artifact@v4
with:
name: streetGraph.obj
path: output/opentripplanner
- name: Download transport graph artifact
uses: actions/download-artifact@v4
with:
name: graph.obj
path: output/opentripplanner
- name: Download network.dat artifact
uses: actions/download-artifact@v4
with:
name: network.dat
path: output/r5r
- name: Download osrm graph artifact
uses: actions/download-artifact@v4
with:
name: osrm-graph
path: output/osrm_driving
- name: Download pretty map artifact
uses: actions/download-artifact@v4
with:
name: map.png
path: output
- name: Prepare README
run: |
devtools::load_all()
prepare_readme()
prepare_bounds_geojson()
shell: Rscript {0}
- name: Prepare otp_and_graph.zip release asset
run: |
mkdir -p assets/otp_and_graph/graph
cp data-raw/otp.jar assets/otp_and_graph/
cp /Users/runner/work/_temp/Library/parochial/extdata/run-otp.bat assets/otp_and_graph/
cp /Users/runner/work/_temp/Library/parochial/extdata/run-otp.sh assets/otp_and_graph/
chmod ugo+x assets/otp_and_graph/run-otp.sh
curl https://raw.githubusercontent.com/opentripplanner/OpenTripPlanner/dev-2.x/LICENSE -o assets/otp_and_graph/OTP_LICENSE
cp output/opentripplanner/graph.obj* assets/otp_and_graph/graph/
cd assets
zip -9 -r otp_and_graph.zip otp_and_graph/
cd ..
- name: Prepare gtfs_and_osm.zip release asset
run: |
mkdir -p assets/gtfs_and_osm
cp output/gtfs/* assets/gtfs_and_osm/
cp output/openstreetmap/* assets/gtfs_and_osm/
mkdir -p assets/gtfs_and_osm/opentripplanner
cd assets
zip -9 -r gtfs_and_osm.zip gtfs_and_osm/
cd ..
- name: Prepare r5r_network_dat.zip release asset
run: |
mkdir -p assets/r5r_network_dat
cp output/r5r/* assets/r5r_network_dat/
cd assets
zip -9 -r r5r_network_dat.zip r5r_network_dat/
cd ..
- name: Prepare osrm_driving.zip release asset
run: |
mkdir -p assets/osrm_driving
cp output/osrm_driving/* assets/osrm_driving/
cd assets
zip -9 -r osrm_driving.zip osrm_driving/
cd ..
- name: Checkout graph-releases branch
uses: actions/checkout@v4
with:
ref: graph-releases
path: graph-releases
- name: Get timestamp for release
id: timestamp
env:
TZ: Europe/London
run: echo "timestamp=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT
- name: Copy READMEs and other files
run: |
cd graph-releases
rm -rf file_metadata
mkdir file_metadata
cp ../output/*-bounds.geojson bounds.geojson
cp ../output/*.meta.json file_metadata/
cp ../output/*/*.meta.json file_metadata/
cp ../output/map.png map.png
cp ../output/output_readme.html index.html
cp ../output/output_readme.md README.md
cd ..
- name: Commit new graph-release
if: github.ref == 'refs/heads/main'
run: |
cd graph-releases
git config user.name "Graph Release Bot"
git config user.email "<>"
git add .
git commit -m "Updated for new release"
git push origin graph-releases
cd ..
- name: Release new graph
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/main'
with:
artifacts: assets/otp_and_graph.zip,assets/gtfs_and_osm.zip,assets/r5r_network_dat.zip,assets/osrm_driving.zip
bodyFile: output/release_body.md
token: ${{ secrets.GITHUB_TOKEN }}
commit: graph-releases
tag: ${{ steps.timestamp.outputs.timestamp }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ATOC_USERNAME: ${{ secrets.ATOC_USERNAME }}
ATOC_PASSWORD: ${{ secrets.ATOC_PASSWORD }}
TNDS_USERNAME: ${{ secrets.TNDS_USERNAME }}
TNDS_PASSWORD: ${{ secrets.TNDS_PASSWORD }}
BOUNDS: ${{ secrets.BOUNDS }}
OUTPUT_AFFIX: ${{ secrets.OUTPUT_AFFIX }}