mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
add check_examples CI script
This commit is contained in:
23
.github/check_examples.py
vendored
Normal file
23
.github/check_examples.py
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import glob
|
||||
import re
|
||||
|
||||
for package in glob.glob("**/package.json",recursive=True):
|
||||
if "node_modules" in package:
|
||||
continue
|
||||
|
||||
with open(package,"r") as f:
|
||||
j = json.loads(f.read())
|
||||
name = j["name"]
|
||||
version = j["version"]
|
||||
|
||||
for html in glob.glob("**/*.html",recursive=True):
|
||||
if "node_modules" in html:
|
||||
continue
|
||||
|
||||
with open(html,"r") as f:
|
||||
matches = re.findall("https://unpkg.com/" + name + r"@(\d+\.\d+\.\d+|latest)/",f.read())
|
||||
for match in matches:
|
||||
if matches[0] == "latest" or matches[0] != version:
|
||||
print(html,"should be",version,"was",matches)
|
||||
exit(1)
|
||||
1
.github/workflows/actions.yml
vendored
1
.github/workflows/actions.yml
vendored
@@ -42,6 +42,7 @@ jobs:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
- run: python .github/check_examples.py
|
||||
- run: cd js && npm install && npm test
|
||||
- run: cd python && python -m unittest test/test_*
|
||||
- run: cd cpp && make
|
||||
|
||||
Reference in New Issue
Block a user