Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

jobs:
validate-html:
test:
runs-on: ubuntu-latest

steps:
Expand All @@ -23,5 +23,12 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm run test:unit

- name: Validate HTML
run: npm run test:html

- name: Lint
run: npm run lint

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ list:
check:
npm run test

.PHONY: build-main-bundle
build-main-bundle:
npm run build

## Make this project ready to be served by a webserver.
.PHONY: ready-for-hosting
ready-for-hosting: dependencies-get
ready-for-hosting: dependencies-get build-main-bundle
$(MAKE) --directory opening_hours.js/ ready-for-hosting

.PHONY: opening_hours+deps.min.js
Expand All @@ -25,26 +29,22 @@ taginfo.json: ./opening_hours.js/scripts/related_tags.txt ./opening_hours.js/scr
./opening_hours.js/scripts/gen_taginfo_json.js --key-file="$<" --template-file=taginfo_template.json > "$@"

.PHONY: dependencies-get
dependencies-get: js/OpenLayers-$(OpenLayersVersion)/OpenLayers.js
dependencies-get:
git verify-commit HEAD || (echo "The author is signing all recent git commits. If the command failed because you don’t have ypid’s key in your keyring, you can import it from a keyserver and verify it’s authenticity." && exit 1)
git submodule update --init --recursive

js/OpenLayers-$(OpenLayersVersion)/OpenLayers.js:
-wget --no-clobber -O js/OpenLayers-$(OpenLayersVersion).tar.gz https://github.com/openlayers/ol2/releases/download/release-$(OpenLayersVersion)/OpenLayers-$(OpenLayersVersion).tar.gz || rm -f js/OpenLayers-$(OpenLayersVersion).tar.gz
tar -xzf js/OpenLayers-$(OpenLayersVersion).tar.gz -C js/

.PHONY: deploy-on-all-servers
deploy-on-all-servers: deploy-on-openingh.openstreetmap.de deploy-on-ypid.de

.PHONY: deploy-on-openingh.openstreetmap.de
deploy-on-openingh.openstreetmap.de: opening_hours+deps.min.js
deploy-on-openingh.openstreetmap.de: opening_hours+deps.min.js build-main-bundle
rsync --archive * everest.openstreetmap.de:~/www -v

# Custom deployment method which allows me to fully isolate the development and build environment from the server.
# Copy tar because qvm-copy blocks relative symlinks.
# Ref: https://github.com/QubesOS/qubes-issues/issues/9667
.PHONY: deploy-on-openingh.openstreetmap.de
deploy-on-ypid.de: opening_hours+deps.min.js
deploy-on-ypid.de: opening_hours+deps.min.js build-main-bundle
rm -f "/tmp/opening_hours_map.tar"
/bin/tar --exclude-vcs --exclude='./js/*.tar.gz' --exclude='./js/OpenLayers-$(OpenLayersVersion)/doc' --exclude='./opening_hours.js/node_modules/bower' --exclude='./opening_hours.js/submodules/panieravide.github.io/id-indoor' --exclude='./opening_hours.js/submodules/panieravide.github.io/pic4carto' --exclude='./opening_hours.js/submodules/YoHours/node_modules/**' --no-acls -cf /tmp/opening_hours_map.tar .
qvm-copy "/tmp/opening_hours_map.tar"
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ The map uses OpenLayers to show a base map from OpenStreetMap. An additional opt

## Development

The app is fully static. Serve `index.html` through any local HTTP server for
development or open the hosted instance directly.

Overpass requests go directly to public fallback endpoints:

- `https://overpass-api.de/api/interpreter`
- `https://overpass.kumi.systems/api/interpreter`
- `https://overpass.private.coffee/api/interpreter`

Network/CORS failures trigger endpoint cooldown and a short global cooldown to
avoid hammering endpoints.

### Building

To build the opening_hours.js library for production:
Expand All @@ -63,7 +75,7 @@ npm test

## Dependencies

* This map is built with [OpenLayers 2.13.1][ol-lib] (legacy version).
* This map is built with [OpenLayers 10][ol-lib].
* The opening_hours evaluation is handled by the [opening_hours.js][oh-lib] library.

## Author
Expand Down
Loading