Skip to content

Commit

Permalink
Visual ci action (#62)
Browse files Browse the repository at this point in the history
GitHub action uploads JSON style layers and moderately sized PMTiles output to external storage endpoint.
GitHub action makes comment on PR linking to visual test page.
  • Loading branch information
bdon authored Jul 17, 2023
1 parent 2c55a60 commit ea00321
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/visual-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Visual CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
NAME: ${{ github.event.number || github.sha }}

jobs:
visual-ci:
name: Generate Visual CI Artifacts
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- run: echo ${{ env.NAME }}
- run: cd base && npm install && npm run --silent generate-layers > light.json
- run : |
cd tiles && mvn -DskipTests=true clean package
- run : |
cd tiles && java -Xms4g -Xmx4g -jar target/*-with-deps.jar --area=taiwan --force --download
- run: |
curl --fail -H "Authorization: ${{ secrets.AUTHORIZATION }}" -T base/light.json https://visual-ci-uploader.protomaps-dev.workers.dev/${{ env.NAME }}/light.json
- run: |
curl --fail -H "Transfer-Encoding: chunked" -H "Authorization: ${{ secrets.AUTHORIZATION }}" -T tiles/taiwan.pmtiles https://visual-ci-uploader.protomaps-dev.workers.dev/${{ env.NAME }}/smalltestregion.pmtiles
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
message: |
Comparison: <https://protomaps.github.io/basemaps/ci/?left=${{ github.event.pull_request.base.sha }}&right=${{ env.NAME }}>
2 changes: 2 additions & 0 deletions base/generate-layers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import i from "./src/index";
process.stdout.write(JSON.stringify(i('protomaps','light'), null, 2));
82 changes: 79 additions & 3 deletions base/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build-cjs": "esbuild src/index.ts --outfile=dist/index.cjs --target=es6 --bundle --format=cjs",
"build-tsc": "tsc --declaration --emitDeclarationOnly --outdir dist",
"build": "npm run build-iife && npm run build-esm && npm run build-cjs && npm run build-tsc",
"generate-layers": "node -r esbuild-runner/register generate-layers.ts",
"tsc": "tsc --noEmit --watch"
},
"repository": {
Expand All @@ -24,5 +25,8 @@
"devDependencies": {
"esbuild": "^0.12.8",
"typescript": "^4.5.5"
},
"dependencies": {
"esbuild-runner": "^2.2.2"
}
}

0 comments on commit ea00321

Please sign in to comment.