Skip to content

Commit

Permalink
Merge pull request #195 from leonardehrenfried/fix-caching
Browse files Browse the repository at this point in the history
Update caching strategy
  • Loading branch information
dulvui authored Aug 6, 2024
2 parents 7228754 + 158433d commit 0a9634d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,30 @@ jobs:
- name: use mobility.api.opendatahub.testingmachine.eu for testing
run: sed -i 's/mobility.api.opendatahub.com/mobility.api.opendatahub.testingmachine.eu/' */config.yml

- name: Cache OSM and elevation data
# elevation data does not change so we cache it forever
- name: Cache elevation data
uses: actions/cache@v4
with:
path: |
data/srtm*
key: elevation

# OSM data changes every day, so we cache a monthly download and apply the daily updates to it
# ideally we also put the updated file back into the cache but Github CI doesn't allow you to
# do that without jumping through many hoops.
# Therefore, we take the version from the beginning of the month and apply more and more daily
# updates until the next month triggers a complete download.
- name: Set variable OSM_CACHE_VERSION
run: |
echo "OSM_CACHE_VERSION=$(date +%Y-%m)" >> $GITHUB_ENV
- name: Cache OSM extract
uses: actions/cache@v4
with:
path: |
data/italy-nord-est.osm.pbf
key: osm-${{ env.OSM_CACHE_VERSION }}

- name: Build graph
run: bash build-graph.sh

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ name: Build graph

on:
- pull_request
- push

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Cache OSM and elevation data
uses: actions/cache@v4
with:
path: |
data/srtm*
data/italy-nord-est.osm.pbf
key: input-data-${{ github.GITHUB_REF_NAME }}

- run: ./build-graph.sh

0 comments on commit 0a9634d

Please sign in to comment.