Skip to content

Commit

Permalink
Test that the example check is working
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Feb 14, 2020
1 parent b554372 commit de78c81
Show file tree
Hide file tree
Showing 89 changed files with 139 additions and 19 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- run: npm --version

- run: sudo apt update
- run: sudo apt install g++-4.8 python3-venv
- run: sudo apt install g++-4.8 python3-venv graphicsmagick fonts-liberation2

- uses: actions/checkout@v1
- run: git config --global user.name "Continuous integration"
Expand All @@ -46,13 +46,22 @@ jobs:
# Webpack build of ngeo/gmf examples and gmf apps
- run: NODE_ENV=production make examples-hosted
- run: make check-examples
- uses: actions/upload-artifact@v1
with:
name: Examples hosted
path: .build/examples-hosted
if: failure()

#- run: npm run typecheck
- run: "! (npm run typecheck|grep -v '^node_modules/'|grep '^[a-z]')"
# Generate API doc
- run: npm run doc
- run: npm run jsdoc
- run: npm run build-api
- run: cat /home/runner/.npm/_logs/*
- uses: actions/upload-artifact@v1
with:
name: Npm logs
path: /home/runner/.npm/_logs
if: failure()

- uses: camptocamp/initialise-gopass-summon-action@v1
Expand Down
36 changes: 26 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -290,35 +290,51 @@ contribs/dist: .build/build-dll.timestamp
.build/node_modules.timestamp \
.build/httpserver.timestamp
mkdir -p $(dir $@)
node buildtools/check-example.js .build/examples-hosted/$*.html
CI=true LANGUAGE=en_US node buildtools/check-example.js \
.build/examples-hosted/$*.html
[ "$$(gm compare -metric RMSE -highlight-style xor .build/examples-hosted/$*.html.png \
examples/$*-ref.png -file .build/examples-hosted/$*.html.png-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
examples/$*-ref.png -file .build/examples-hosted/$*.html.png-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
touch $@

.build/error.check.timestamp: .build/examples-ngeo.timestamp \
.build/node_modules.timestamp \
.build/httpserver.timestamp
mkdir -p $(dir $@)
CI=true LANGUAGE=en_US node buildtools/check-example.js \
.build/examples-hosted/error.html
gm compare -metric RMSE -highlight-style xor .build/examples-hosted/error.html.png \
examples/error-ref.png -file .build/examples-hosted/error.html.png-diff.png
[ "$$(gm compare -metric RMSE -highlight-style xor .build/examples-hosted/error.html.png \
examples/error-ref.png -file .build/examples-hosted/error.html.png-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \> 0.005 ]
touch $@

.build/contribs/gmf/%.check.timestamp: .build/examples-gmf.timestamp \
.build/node_modules.timestamp \
.build/httpserver.timestamp
mkdir -p $(dir $@)
node buildtools/check-example.js .build/examples-hosted/contribs/gmf/$*.html
CI=true LANGUAGE=en_US node buildtools/check-example.js \
.build/examples-hosted/contribs/gmf/$*.html
[ "$$(gm compare -metric RMSE -highlight-style xor .build/examples-hosted/contribs/gmf/$*.html.png \
contribs/gmf/examples/$*-ref.png -file .build/examples-hosted/contribs/gmf/$*-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
contribs/gmf/examples/$*-ref.png -file .build/examples-hosted/contribs/gmf/$*-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
touch $@

.build/contribs/gmf/apps/%.check.timestamp: .build/gmf-apps.timestamp \
.build/httpserver.timestamp
mkdir -p $(dir $@)
node buildtools/check-example.js .build/examples-hosted/contribs/gmf/apps/$*.html
CI=true LANGUAGE=en_US node buildtools/check-example.js \
.build/examples-hosted/contribs/gmf/apps/$*.html
[ "$$(gm compare -metric RMSE -highlight-style xor .build/examples-hosted/contribs/gmf/apps/$*.html.png \
contribs/gmf/apps/$*-ref.png -file .build/examples-hosted/contribs/gmf/apps/$*-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
contribs/gmf/apps/$*-ref.png -file .build/examples-hosted/contribs/gmf/apps/$*-diff.png 2>&1 | \
tail --lines=1 | sed 's/.* \([0-9\.]\+\) .*/\1/g')" \< 0.005 ]
touch $@

.build/test-check-example/%.check.timestamp: \
.build/httpserver.timestamp test/check-example/%.html
mkdir -p $(dir $@)
( ! node buildtools/check-example.js test/check-example/$*.html)
( ! CI=true LANGUAGE=en_US node buildtools/check-example.js test/check-example/$*.html)
touch $@

.build/node_modules.timestamp: package.json
Expand Down
14 changes: 11 additions & 3 deletions buildtools/check-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ function loaded(page, browser) {
await browser.close();
}
}
}, 2000);
}, 1000);
}
(async () => {
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-web-security', '--single-process']});
browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-web-security', '--single-process'],
headless: true
});
const page = await browser.newPage();

await page.setViewport({width: 1920, height: 1080});
await page.setRequestInterception(true);
page.on('pageerror', async e => {
Expand Down Expand Up @@ -132,7 +136,11 @@ function loaded(page, browser) {
request.headers().origin = 'http://localhost:3000';
}
request.continue({
url
url,
// Don't be intranet
headers: {
'Forwarded': 'for=8.8.8.8;proto=https'
}
});
} else if (url.includes('tile.openstreetmap.org') ||
url.startsWith('https://tiles.openseamap.org') ||
Expand Down
Binary file modified contribs/gmf/apps/desktop-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions contribs/gmf/apps/desktop/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
* @ngInject
*/
constructor($scope, $injector) {
super({
Expand Down
Binary file modified contribs/gmf/apps/desktop_alt-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/apps/iframe_api-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/apps/mobile-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/apps/mobile_alt-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/apps/oeedit-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/authentication-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/backgroundlayerselector-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/contextualdata-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/datepicker-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/displayquerygrid-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/displayquerywindow-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/drawfeature-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/editfeature-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/editfeatureselector-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/elevation-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/featurestyle-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/filterselector-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/importdatasource-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/layertree-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/layertreeadd-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/lidarprofile-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions contribs/gmf/examples/lidarprofile.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gmf-map > div {
width: 80rem;
height: 40rem;
width: 60rem;
height: 30rem;
}
#gmf-lidarprofile-container {
position: relative;
Expand Down
Binary file modified contribs/gmf/examples/mobilemeasure-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/mouseposition-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/objectediting-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified contribs/gmf/examples/objecteditinghub-ref.png
Binary file modified contribs/gmf/examples/permalink-ref.png
Binary file modified contribs/gmf/examples/print-ref.png
Binary file modified contribs/gmf/examples/profile-ref.png
4 changes: 2 additions & 2 deletions contribs/gmf/examples/profile.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gmf-map > div {
width: 80rem;
height: 40rem;
width: 60rem;
height: 30rem;
}
.gmf-profile-container {
display: flex;
Expand Down
Binary file modified contribs/gmf/examples/search-ref.png
Binary file modified contribs/gmf/examples/share-ref.png
Binary file modified contribs/gmf/examples/simple-ref.png
Binary file modified contribs/gmf/examples/themeselector-ref.png
Binary file modified contribs/gmf/examples/timeslider-ref.png
Binary file modified contribs/gmf/examples/wfspermalink-ref.png
Binary file modified contribs/gmf/examples/xsdattributes-ref.png
Binary file modified examples/animation-ref.png
Binary file modified examples/asitvd-ref.png
Binary file modified examples/attributes-ref.png
Binary file modified examples/backgroundlayer-ref.png
Binary file modified examples/backgroundlayerdropdown-ref.png
Binary file modified examples/colorpicker-ref.png
Binary file modified examples/control-ref.png
Binary file modified examples/createfeature-ref.png
Binary file modified examples/datepicker-ref.png
Binary file modified examples/datetimepicker-ref.png
Binary file modified examples/disclaimer-ref.png
Binary file modified examples/displaywindow-ref.png
Binary file modified examples/drawfeature-ref.png
Binary file modified examples/elevationProfile-ref.png
Binary file added examples/error-ref.png
5 changes: 5 additions & 0 deletions examples/error.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#map {
width: 600px;
height: 400px;
}
15 changes: 15 additions & 0 deletions examples/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html ng-app='app'>
<head>
<title>Simple example</title>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1.0, user-scalable=no, width=device-width">
<meta name="mobile-web-app-capable" content="yes">
</head>
<body ng-controller="MainController as ctrl">
<div id="map" ngeo-map="ctrl.map"></div>
<p id="desc">This example shows how to use the <code><a href="../apidoc/ngeo.map.component.html" title="Read our documentation">ngeo-map</a></code> component to insert an OpenLayers map in a page.</p>
<script type="text/javascript" src="dist/vendor.js"></script>
</body>
</html>
66 changes: 66 additions & 0 deletions examples/error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// The MIT License (MIT)
//
// Copyright (c) 2014-2020 Camptocamp SA
//
// 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.


import './simple.css';
import angular from 'angular';
import olMap from 'ol/Map.js';

import olView from 'ol/View.js';
import olLayerTile from 'ol/layer/Tile.js';
import olSourceOSM from 'ol/source/OSM.js';
import ngeoMapModule from 'ngeo/map/module.js';


/** @type {angular.IModule} **/
const module = angular.module('app', [
'gettext',
ngeoMapModule.name
]);


/**
* @constructor
* @ngInject
*/
function MainController() {

/**
* @type {import("ol/Map.js").default}
*/
this.map = new olMap({
layers: [
new olLayerTile({
source: new olSourceOSM()
})
],
view: new olView({
center: [0, 0],
zoom: 4
})
});
}


module.controller('MainController', MainController);


export default module;
Binary file modified examples/googlestreetview-ref.png
Binary file modified examples/grid-ref.png
Binary file modified examples/importfeatures-ref.png
Binary file modified examples/interactionbtngroup-ref.png
Binary file modified examples/layerorder-ref.png
Binary file modified examples/layertree-ref.png
Binary file modified examples/locationsearch-ref.png
Binary file modified examples/mapfishprint-ref.png
Binary file modified examples/mapswipe-ref.png
Binary file modified examples/measure-ref.png
Binary file modified examples/mobilegeolocation-ref.png
Binary file modified examples/modal-ref.png
Binary file modified examples/modifycircle-ref.png
Binary file modified examples/modifyrectangle-ref.png
Binary file modified examples/notification-ref.png
Binary file modified examples/offline-ref.png
Binary file modified examples/permalink-ref.png
Binary file modified examples/popover-ref.png
Binary file modified examples/popupservice-ref.png
Binary file modified examples/query-ref.png
Binary file modified examples/recenter-ref.png
Binary file modified examples/rotate-ref.png
Binary file modified examples/routing-ref.png
Binary file modified examples/scaleselector-ref.png
Binary file modified examples/search-ref.png
Binary file modified examples/simple-ref.png
Binary file modified examples/simple3d-ref.png
Binary file modified examples/svg-ref.png
Binary file modified examples/toolActivate-ref.png

0 comments on commit de78c81

Please sign in to comment.