-
-
Notifications
You must be signed in to change notification settings - Fork 82
Add render tests #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Add render tests #477
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
931269b
Add Monaco build test
wipfli 995fe6e
Move to script
wipfli 868dec8
Add render tests folder
wipfli 2524c45
First successful render test run
wipfli 62b830e
Remove custom layer
wipfli 18e5669
Use express instead of st for range request support in pmtiles protocol
wipfli 98907ef
Trim
wipfli e0def74
Trim
wipfli 0dc6fd3
Use basemap styles
wipfli cc56359
Rename
wipfli a22f61a
Add monaco osm extract
wipfli bf2d2a7
Add generate pmtiles script
wipfli 2228327
Update github workflow
wipfli ca79f55
Upload results.html on failure
wipfli d7130e9
Update expected image
wipfli 7a87823
Change roads label color
wipfli cc3971f
Update readme
wipfli 7569204
Revert font color changes
wipfli 0c6ddbc
Remove tiles monaco build script
wipfli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Derived from planetiler (Apache License) | ||
| # https://github.com/onthegomap/planetiler/blob/main/.github/workflows/maven.yml | ||
|
|
||
| name: Render Tests CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| render_tests: | ||
| name: Render tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: 21 | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version-file: 'render-tests/.nvmrc' | ||
| - name: Generate PMTiles | ||
| working-directory: render-tests | ||
| run: ./generate_pmtiles.sh | ||
| - name: Build styles | ||
| run: npm ci && npm run build | ||
| working-directory: styles | ||
| - name: Build render tests | ||
| run: npm ci && npm run build | ||
| working-directory: render-tests | ||
| - name: Run render tests | ||
| run: npm run test | ||
| working-directory: render-tests | ||
| - name: Upload render test results.html on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: render-test-report | ||
| path: ${{ github.workspace }}/render-tests/results.html | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| dist/ | ||
| pmtiles/ | ||
| node_modules/ | ||
| junit.xml | ||
| *.txt | ||
| results.html | ||
| tests/**/diff.png | ||
| tests/**/actual.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 20.16.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| Copyright (c) 2025, Protomaps | ||
|
|
||
| Copyright (c) 2023, MapLibre contributors | ||
|
|
||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without modification, | ||
| are permitted provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
| * Neither the name of MapLibre GL JS nor the names of its contributors | ||
| may be used to endorse or promote products derived from this software | ||
| without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| ------------------------------------------------------------------------------- | ||
|
|
||
| Contains code from mapbox-gl-js v1.13 and earlier | ||
|
|
||
| Version v1.13 of mapbox-gl-js and earlier are licensed under a BSD-3-Clause license | ||
|
|
||
| Copyright (c) 2020, Mapbox | ||
| Redistribution and use in source and binary forms, with or without modification, | ||
| are permitted provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
| * Neither the name of Mapbox GL JS nor the names of its contributors | ||
| may be used to endorse or promote products derived from this software | ||
| without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| ------------------------------------------------------------------------------- | ||
|
|
||
| Contains code from glfx.js | ||
|
|
||
| Copyright (C) 2011 by Evan Wallace | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
|
|
||
| -------------------------------------------------------------------------------- | ||
|
|
||
| Contains a portion of d3-color https://github.com/d3/d3-color | ||
|
|
||
| Copyright 2010-2016 Mike Bostock | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without modification, | ||
| are permitted provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, this | ||
| list of conditions and the following disclaimer. | ||
|
|
||
| * Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
|
|
||
| * Neither the name of the author nor the names of contributors may be used to | ||
| endorse or promote products derived from this software without specific prior | ||
| written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Render Tests | ||
|
|
||
| ## Usage | ||
|
|
||
| Use the node version in the nvmrc file with `nvm use`. | ||
|
|
||
| First build the styles package locally: | ||
|
|
||
| ``` | ||
| cd ../styles | ||
| npm ci | ||
| npm run build | ||
| ``` | ||
|
|
||
| Then install the dependencies in the render-test folder with: | ||
|
|
||
| ``` | ||
| npm ci | ||
| ``` | ||
|
|
||
| Then build the render test runner: | ||
|
|
||
| ``` | ||
| npm run build | ||
| ``` | ||
|
|
||
| The render test runner is now ready, but we still need to generate some pmtiles with: | ||
|
|
||
| ``` | ||
| ./generate_pmtiles.sh | ||
| ``` | ||
|
|
||
| You should now have a folder `pmtiles`. | ||
|
|
||
| Then run the render tests with: | ||
|
|
||
| ``` | ||
| npm run test | ||
| ``` | ||
|
|
||
| This will create a `results.html` file. Have a look at it with something like | ||
|
|
||
| ``` | ||
| npx serve . | ||
| ``` | ||
|
|
||
| ## Updating Tests | ||
|
|
||
| When `expected.png` images should change, you can tell the render test runner to copy the `actual.png` to the `expected.png` images with: | ||
|
|
||
| ``` | ||
| UPDATE=true npm run test | ||
| ``` | ||
|
|
||
| ## Looking at CI `results.html` | ||
|
|
||
| The `results.html` generated by GitHub actions runners can be downloaded at the end of the run. The html file will be inside a zip container. This can be convenient to get access to exactly the pixels that are generate in CI. | ||
|
|
||
| ## License | ||
|
|
||
| The code in this folder has been derived from the render tests of MapLibre GL, a fork of Mapbox GL. The license therefore is based on MapLibre's license (BSD), see [LICENSE.md](./LICENSE.md). |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| mkdir -p pmtiles | ||
| cd ../tiles | ||
| mvn clean package -DskipTests | ||
| java -Xmx2g -jar target/protomaps-basemap-HEAD-with-deps.jar \ | ||
| --osm_path=../render-tests/fixtures/monaco-2025-02-15.osm.pbf \ | ||
| --output=../render-tests/pmtiles/monaco-roads.pmtiles \ | ||
| --force \ | ||
| --nodemap-type=sparsearray \ | ||
| --layer=roads | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.