From eaf8713be6de55c8aad407d3a5506a366f023636 Mon Sep 17 00:00:00 2001 From: Wentao Kuang Date: Thu, 10 Oct 2024 12:28:48 +1300 Subject: [PATCH] feat: Add screenshot test into CI and fix the health test for NZTM2000Quad. BM-1087 (#422) ### Motivation We need fix the health screenshot test to point to the health tileset. Also, adding the screenshot into ci will be helpful for use to see any screenshot test been updated. ### Modifications - Fix the tileset for `health-2193-z3`. - Add a github action to take screenshots. ### Verification See the PR workflow outputs. --- .github/workflows/screenshot.yml | 52 ++++++++++++++++++++++++++++++++ src/tiles.ts | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/screenshot.yml diff --git a/.github/workflows/screenshot.yml b/.github/workflows/screenshot.yml new file mode 100644 index 0000000..23aed72 --- /dev/null +++ b/.github/workflows/screenshot.yml @@ -0,0 +1,52 @@ +name: screenshot + +on: + pull_request: + push: + branches: + - master + +jobs: + screenshot: + runs-on: ubuntu-latest + + permissions: + id-token: write + contents: read + steps: + - uses: linz/action-typescript@v3 + + - name: (Screenshot) Screenshot Pull Request Changes + run: | + ./bms.mjs --url https://basemaps.linz.govt.nz --output .artifacts/visual-snapshots + + - name: Save snapshots + uses: getsentry/action-visual-snapshot@v2 + with: + save-only: true + snapshot-path: .artifacts/visual-snapshots + + visual-diff: + permissions: + id-token: write + contents: write + checks: write + needs: [screenshot] + name: validate screenshots + if: github.ref != 'refs/heads/master' && github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: AWS Configure + uses: aws-actions/configure-aws-credentials@v4.0.2 + with: + aws-region: ap-southeast-2 + mask-aws-account-id: true + role-to-assume: ${{ secrets.AWS_ROLE_SCREENSHOT }} + + - name: Diff snapshots + id: visual-snapshots-diff + uses: blacha/action-visual-snapshot@v2 + with: + storage-prefix: 's3://linz-basemaps-screenshot' + storage-url: 'https://d25mfjh9syaxsr.cloudfront.net' diff --git a/src/tiles.ts b/src/tiles.ts index 4ef8d62..e4aedc8 100644 --- a/src/tiles.ts +++ b/src/tiles.ts @@ -32,7 +32,7 @@ export const DefaultTestTiles: TestTile[] = [ name: 'health-2193-z3', tileMatrix: TileMatrixIdentifier.Nztm2000Quad, location: { lat: -41.8899962, lng: 174.0492437, z: 3 }, - tileSet: 'aerial', + tileSet: 'health', }, { name: 'aerial-3857-wellington-urban-z16',