From 8c1fc59fb5916e5ab8816fb26e56a49330a74465 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 17:38:56 -0700 Subject: [PATCH 1/8] Build the map daily using GitHub Actions --- .github/workflows/build_cycling.yml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build_cycling.yml diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml new file mode 100644 index 0000000..ae4b6ea --- /dev/null +++ b/.github/workflows/build_cycling.yml @@ -0,0 +1,38 @@ +name: Build Transitopia Cycling Layer + +on: + push: + schedule: + # Every day at 09:45 UTC + - cron: '45 9 * * *' +jobs: + Build-Cycling-Layer: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Check out code + uses: actions/checkout@v4 + - name: Compile code + run: ./mvnw clean package + - name: Ensure fresh OSM data + run: rm -f data/sources/british_columbia.osm.pbf + - name: Build the map using planetiler + run: java -jar target/planetiler-*-with-deps.jar --force --download + - name: Store resulting artifacts + uses: actions/upload-artifact@v4 + with: + name: compiled-maps + path: data/*.pmtiles + Upload: + runs-on: ubuntu-latest + needs: Build-Cycling-Layer + steps: + - uses: actions/checkout@v4 + - name: Download compiled maps + uses: actions/download-artifact@v4 + with: + name: compiled-maps + - name: renames + run: mv data/transitopia-cycling-british-columbia.pmtiles data/transitopia-cycling-bc.pmtiles + - name: upload + run: rclone copy data/transitopia-cycling-bc.pmtiles transitopia-maps-r2:transitopia-maps/transitopia-cycling-bc.pmtiles --s3-no-check-bucket From 5c338d399d420a96e2ceca9e6e8a8fc3f2e082ae Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 17:44:55 -0700 Subject: [PATCH 2/8] WIP --- .github/workflows/build_cycling.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index ae4b6ea..ac20675 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -12,6 +12,10 @@ jobs: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - name: Check out code uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' - name: Compile code run: ./mvnw clean package - name: Ensure fresh OSM data From 14eeb49f12e748c226c52d457dbc2bca933e6996 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 18:54:37 -0700 Subject: [PATCH 3/8] WIP --- .github/workflows/build_cycling.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index ac20675..4cb0124 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -16,6 +16,13 @@ jobs: with: distribution: temurin java-version: '21' + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- - name: Compile code run: ./mvnw clean package - name: Ensure fresh OSM data @@ -30,13 +37,16 @@ jobs: Upload: runs-on: ubuntu-latest needs: Build-Cycling-Layer + env: + RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_TYPE: s3 + RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_PROVIDER: Cloudflare + # Other rclone config variables are private steps: - - uses: actions/checkout@v4 - name: Download compiled maps uses: actions/download-artifact@v4 with: name: compiled-maps - name: renames - run: mv data/transitopia-cycling-british-columbia.pmtiles data/transitopia-cycling-bc.pmtiles + run: mv transitopia-cycling-british-columbia.pmtiles transitopia-cycling-bc.pmtiles - name: upload - run: rclone copy data/transitopia-cycling-bc.pmtiles transitopia-maps-r2:transitopia-maps/transitopia-cycling-bc.pmtiles --s3-no-check-bucket + run: rclone copy transitopia-cycling-bc.pmtiles transitopia_maps_r2:transitopia-maps --s3-no-check-bucket From 3a1fed51ff2494e938ad7ba8c5b608023596b82d Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 19:08:24 -0700 Subject: [PATCH 4/8] WIP --- .github/workflows/build_cycling.yml | 76 +++++++++++++++-------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index 4cb0124..865ecaa 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -6,34 +6,34 @@ on: # Every day at 09:45 UTC - cron: '45 9 * * *' jobs: - Build-Cycling-Layer: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - name: Check out code - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: '21' - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Compile code - run: ./mvnw clean package - - name: Ensure fresh OSM data - run: rm -f data/sources/british_columbia.osm.pbf - - name: Build the map using planetiler - run: java -jar target/planetiler-*-with-deps.jar --force --download - - name: Store resulting artifacts - uses: actions/upload-artifact@v4 - with: - name: compiled-maps - path: data/*.pmtiles + # Build-Cycling-Layer: + # runs-on: ubuntu-latest + # steps: + # - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + # - name: Check out code + # uses: actions/checkout@v4 + # - uses: actions/setup-java@v4 + # with: + # distribution: temurin + # java-version: '21' + # - name: Cache local Maven repository + # uses: actions/cache@v4 + # with: + # path: ~/.m2/repository + # key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + # restore-keys: | + # ${{ runner.os }}-maven- + # - name: Compile code + # run: ./mvnw clean package + # - name: Ensure fresh OSM data + # run: rm -f data/sources/british_columbia.osm.pbf + # - name: Build the map using planetiler + # run: java -jar target/planetiler-*-with-deps.jar --force --download + # - name: Store resulting artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: compiled-maps + # path: data/*.pmtiles Upload: runs-on: ubuntu-latest needs: Build-Cycling-Layer @@ -42,11 +42,15 @@ jobs: RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_PROVIDER: Cloudflare # Other rclone config variables are private steps: - - name: Download compiled maps - uses: actions/download-artifact@v4 - with: - name: compiled-maps - - name: renames - run: mv transitopia-cycling-british-columbia.pmtiles transitopia-cycling-bc.pmtiles - - name: upload - run: rclone copy transitopia-cycling-bc.pmtiles transitopia_maps_r2:transitopia-maps --s3-no-check-bucket + - name: Install rclone + run: sudo apt install --yes rclone + - name: Temp test rclone + run: rclone ls transitopia_maps_r2:transitopia-maps --s3-no-check-bucket + # - name: Download compiled maps + # uses: actions/download-artifact@v4 + # with: + # name: compiled-maps + # - name: renames + # run: mv transitopia-cycling-british-columbia.pmtiles transitopia-cycling-bc.pmtiles + # - name: upload + # run: rclone copy transitopia-cycling-bc.pmtiles transitopia_maps_r2:transitopia-maps --s3-no-check-bucket From ba76b22b266a65c883e177ad07784de8b13ca76d Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 19:09:02 -0700 Subject: [PATCH 5/8] WIP --- .github/workflows/build_cycling.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index 865ecaa..31ec7b7 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -36,7 +36,7 @@ jobs: # path: data/*.pmtiles Upload: runs-on: ubuntu-latest - needs: Build-Cycling-Layer + # needs: Build-Cycling-Layer env: RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_TYPE: s3 RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_PROVIDER: Cloudflare From 286198202af3899dd5091d20f6eb53abec890200 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 19:14:16 -0700 Subject: [PATCH 6/8] WIP --- .github/workflows/build_cycling.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index 31ec7b7..2a23afb 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -40,8 +40,12 @@ jobs: env: RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_TYPE: s3 RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_PROVIDER: Cloudflare - # Other rclone config variables are private + RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_ENDPOINT: ${{ secrets.RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_ENDPOINT }} + RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_ACCESS_KEY_ID: ${{ secrets.RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_ACCESS_KEY_ID }} + RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_SECRET_ACCESS_KEY: ${{ secrets.RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_SECRET_ACCESS_KEY }} steps: + - name: Skip time-consuming man-db update on apt installs + run: sudo apt-get remove --purge man-db - name: Install rclone run: sudo apt install --yes rclone - name: Temp test rclone From 23575b8fc349fb4c0faf7f60e8b5a3bb46fceeba Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 19:15:15 -0700 Subject: [PATCH 7/8] WIP --- .github/workflows/build_cycling.yml | 76 ++++++++++++++--------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index 2a23afb..65d63b5 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -6,37 +6,37 @@ on: # Every day at 09:45 UTC - cron: '45 9 * * *' jobs: - # Build-Cycling-Layer: - # runs-on: ubuntu-latest - # steps: - # - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - # - name: Check out code - # uses: actions/checkout@v4 - # - uses: actions/setup-java@v4 - # with: - # distribution: temurin - # java-version: '21' - # - name: Cache local Maven repository - # uses: actions/cache@v4 - # with: - # path: ~/.m2/repository - # key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - # restore-keys: | - # ${{ runner.os }}-maven- - # - name: Compile code - # run: ./mvnw clean package - # - name: Ensure fresh OSM data - # run: rm -f data/sources/british_columbia.osm.pbf - # - name: Build the map using planetiler - # run: java -jar target/planetiler-*-with-deps.jar --force --download - # - name: Store resulting artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: compiled-maps - # path: data/*.pmtiles + Build-Cycling-Layer: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Check out code + uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Compile code + run: ./mvnw clean package + - name: Ensure fresh OSM data + run: rm -f data/sources/british_columbia.osm.pbf + - name: Build the map using planetiler + run: java -jar target/planetiler-*-with-deps.jar --force --download + - name: Store resulting artifacts + uses: actions/upload-artifact@v4 + with: + name: compiled-maps + path: data/*.pmtiles Upload: runs-on: ubuntu-latest - # needs: Build-Cycling-Layer + needs: Build-Cycling-Layer env: RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_TYPE: s3 RCLONE_CONFIG_TRANSITOPIA_MAPS_R2_PROVIDER: Cloudflare @@ -48,13 +48,11 @@ jobs: run: sudo apt-get remove --purge man-db - name: Install rclone run: sudo apt install --yes rclone - - name: Temp test rclone - run: rclone ls transitopia_maps_r2:transitopia-maps --s3-no-check-bucket - # - name: Download compiled maps - # uses: actions/download-artifact@v4 - # with: - # name: compiled-maps - # - name: renames - # run: mv transitopia-cycling-british-columbia.pmtiles transitopia-cycling-bc.pmtiles - # - name: upload - # run: rclone copy transitopia-cycling-bc.pmtiles transitopia_maps_r2:transitopia-maps --s3-no-check-bucket + - name: Download compiled maps + uses: actions/download-artifact@v4 + with: + name: compiled-maps + - name: renames + run: mv transitopia-cycling-british-columbia.pmtiles transitopia-cycling-bc.pmtiles + - name: upload + run: rclone copy transitopia-cycling-bc.pmtiles transitopia_maps_r2:transitopia-maps --s3-no-check-bucket From 16af0418b67230e9be997480950dfe22fbef7f7b Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Mon, 4 Aug 2025 19:35:36 -0700 Subject: [PATCH 8/8] Finish --- .github/workflows/build_cycling.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cycling.yml b/.github/workflows/build_cycling.yml index 65d63b5..fdd7c7a 100644 --- a/.github/workflows/build_cycling.yml +++ b/.github/workflows/build_cycling.yml @@ -1,7 +1,7 @@ name: Build Transitopia Cycling Layer on: - push: + pull_request: schedule: # Every day at 09:45 UTC - cron: '45 9 * * *' @@ -9,7 +9,6 @@ jobs: Build-Cycling-Layer: runs-on: ubuntu-latest steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - name: Check out code uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -34,7 +33,9 @@ jobs: with: name: compiled-maps path: data/*.pmtiles - Upload: + Deploy: + # Only deploy this once per day in any case. + if: github.event_name == 'schedule' runs-on: ubuntu-latest needs: Build-Cycling-Layer env: