planetiler/.github/workflows/performance.yml

95 wiersze
3.1 KiB
YAML

# This workflow builds a map using the base and branch commit of a PR and uploads
# the logs as an artifact that update-pr.yml uses to add back as a comment.
name: Performance
on:
pull_request:
branches: [ main ]
env:
# For performance tests, run this branch against main with:
AREA: rhode island
RAM: 4g
# Also pick up a good chunk of the atlantic ocean to catch any regressions in repeated tile performance
# Omit to infer from .osm.pbf bounds
BOUNDS_ARG: "--bounds=-74.07,21.34,-17.84,43.55"
jobs:
performance:
name: Performance Test
runs-on: ubuntu-latest
timeout-minutes: 20
continue-on-error: true
steps:
- name: 'Cancel previous runs'
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: 'Checkout branch'
uses: actions/checkout@v4
with:
path: branch
submodules: true
- name: 'Checkout base'
uses: actions/checkout@v4
with:
path: base
ref: ${{ github.event.pull_request.base.sha }}
submodules: true
- name: Cache data/sources
uses: ./branch/.github/cache-sources-action
with:
basedir: branch
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- uses: actions/setup-node@v4
with:
node-version: '14'
- run: npm install -g strip-ansi-cli@3.0.2
- name: 'Build branch'
run: ./scripts/build.sh
working-directory: branch
- name: 'Build base'
run: ./scripts/build.sh
working-directory: base
- name: 'Download data'
run: |
set -eo pipefail
cp base/planetiler-dist/target/*with-deps.jar run.jar && java -jar run.jar --only-download --area="${{ env.AREA }}"
cp branch/planetiler-dist/target/*with-deps.jar run.jar && java -jar run.jar --only-download --area="${{ env.AREA }}"
- name: 'Store build info'
run: |
mkdir build-info
echo "${{ github.event.pull_request.base.sha }}" > build-info/base_sha
echo "${{ github.sha }}" > build-info/branch_sha
echo "${{ github.event.number }}" > build-info/pull_request_number
- name: 'Run branch'
run: |
rm -rf data/out.mbtiles data/tmp
cp branch/planetiler-dist/target/*with-deps.jar run.jar
java -Xms${{ env.RAM }} -Xmx${{ env.RAM }} -jar run.jar --area="${{ env.AREA }}" "${{ env.BOUNDS_ARG }}" --output=data/out.mbtiles --keep-unzipped 2>&1 | tee log
ls -alh run.jar | tee -a log
cat log | strip-ansi > build-info/branchlogs.txt
- name: 'Run base'
run: |
rm -rf data/out.mbtiles data/tmp
cp base/planetiler-dist/target/*with-deps.jar run.jar
java -Xms${{ env.RAM }} -Xmx${{ env.RAM }} -jar run.jar --area="${{ env.AREA }}" "${{ env.BOUNDS_ARG }}" --output=data/out.mbtiles --keep-unzipped 2>&1 | tee log
ls -alh run.jar | tee -a log
cat log | strip-ansi > build-info/baselogs.txt
- name: 'Upload build-info'
uses: actions/upload-artifact@v4
with:
name: build-info
path: ./build-info