Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/render.yml
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

8 changes: 8 additions & 0 deletions render-tests/.gitignore
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
1 change: 1 addition & 0 deletions render-tests/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.16.0
118 changes: 118 additions & 0 deletions render-tests/LICENSE.md
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.
61 changes: 61 additions & 0 deletions render-tests/README.md
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 added render-tests/fixtures/monaco-2025-02-15.osm.pbf
Binary file not shown.
9 changes: 9 additions & 0 deletions render-tests/generate_pmtiles.sh
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
Loading
Loading