Skip to content

Commit

Permalink
Merge branch 'master' into feat/feature-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang authored Oct 8, 2024
2 parents 90d9abc + 5b207de commit 5ce3e0f
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 13 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ jobs:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: '@basemaps/cli - Build and export to Docker'
uses: docker/build-push-action@v5
with:
context: packages/cli
load: true
tags: |
ghcr.io/linz/basemaps/cli:latest
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
- name: '@basemaps/cli - Test'
run: |
docker run --rm ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }} --help
- name: '@basemaps/cli - Build and push'
uses: docker/build-push-action@v5
with:
Expand All @@ -77,9 +90,21 @@ jobs:
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version_major }}
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version_major_minor }}
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

- name: '@basemaps/server - Build and export to Docker'
uses: docker/build-push-action@v5
with:
context: packages/server
load: true
tags: |
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
- name: '@basemaps/server - Test'
run: |
docker run --rm ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }} --version
- name: '@basemaps/server - Build and push'
uses: docker/build-push-action@v5
with:
Expand All @@ -102,3 +127,4 @@ jobs:
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version_major_minor }}
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [7.11.1](https://github.com/linz/basemaps/compare/v7.11.0...v7.11.1) (2024-10-01)


### Bug Fixes

* **cli:** Install server package in the cli container to inlcude lerc. ([#3353](https://github.com/linz/basemaps/issues/3353)) ([9b2b785](https://github.com/linz/basemaps/commit/9b2b785deaa87c94f1ec2254b91c1ed8993a72f3))





# [7.11.0](https://github.com/linz/basemaps/compare/v7.10.0...v7.11.0) (2024-09-29)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"conventionalCommits": true
}
},
"version": "7.11.0"
"version": "7.11.1"
}
10 changes: 5 additions & 5 deletions package-lock.json

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

8 changes: 8 additions & 0 deletions packages/bathymetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [7.11.1](https://github.com/linz/basemaps/compare/v7.11.0...v7.11.1) (2024-10-01)

**Note:** Version bump only for package @basemaps/bathymetry





# [7.11.0](https://github.com/linz/basemaps/compare/v7.10.0...v7.11.0) (2024-09-29)

**Note:** Version bump only for package @basemaps/bathymetry
Expand Down
4 changes: 2 additions & 2 deletions packages/bathymetry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@basemaps/bathymetry",
"version": "7.11.0",
"version": "7.11.1",
"repository": {
"type": "git",
"url": "https://github.com/linz/basemaps.git",
Expand Down Expand Up @@ -28,7 +28,7 @@
"build/"
],
"dependencies": {
"@basemaps/cli": "^7.11.0",
"@basemaps/cli": "^7.11.1",
"@basemaps/geo": "^7.11.0",
"@basemaps/shared": "^7.11.0",
"@rushstack/ts-command-line": "^4.3.13",
Expand Down
11 changes: 11 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [7.11.1](https://github.com/linz/basemaps/compare/v7.11.0...v7.11.1) (2024-10-01)


### Bug Fixes

* **cli:** Install server package in the cli container to inlcude lerc. ([#3353](https://github.com/linz/basemaps/issues/3353)) ([9b2b785](https://github.com/linz/basemaps/commit/9b2b785deaa87c94f1ec2254b91c1ed8993a72f3))





# [7.11.0](https://github.com/linz/basemaps/compare/v7.10.0...v7.11.0) (2024-09-29)


Expand Down
3 changes: 2 additions & 1 deletion packages/cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ RUN npm install sharp@0.33.0
COPY ./basemaps-landing*.tgz /app/
COPY ./basemaps-cogify*.tgz /app/
COPY ./basemaps-smoke*.tgz /app/
COPY ./basemaps-server*.tgz /app/

# Copy the static files for v1/health check
COPY ./static/ /app/static/

RUN npm install ./basemaps-landing*.tgz ./basemaps-cogify*.tgz ./basemaps-smoke*.tgz
RUN npm install ./basemaps-landing*.tgz ./basemaps-cogify*.tgz ./basemaps-smoke*.tgz ./basemaps-server*.tgz

COPY dist/index.cjs /app/

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@basemaps/cli",
"version": "7.11.0",
"version": "7.11.1",
"private": false,
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/cogify/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [7.11.1](https://github.com/linz/basemaps/compare/v7.11.0...v7.11.1) (2024-10-01)

**Note:** Version bump only for package @basemaps/cogify





# [7.11.0](https://github.com/linz/basemaps/compare/v7.10.0...v7.11.0) (2024-09-29)

**Note:** Version bump only for package @basemaps/cogify
Expand Down
4 changes: 2 additions & 2 deletions packages/cogify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@basemaps/cogify",
"version": "7.11.0",
"version": "7.11.1",
"private": false,
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,7 +40,7 @@
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"devDependencies": {
"@basemaps/cli": "^7.11.0",
"@basemaps/cli": "^7.11.1",
"@basemaps/config": "^7.11.0",
"@basemaps/config-loader": "^7.11.0",
"@basemaps/geo": "^7.11.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/lambda-tiler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { configImageryGet, configTileSetGet } from './routes/config.js';
import { fontGet, fontList } from './routes/fonts.js';
import { healthGet } from './routes/health.js';
import { imageryGet } from './routes/imagery.js';
import { linkGet } from './routes/link.js';
import { pingGet } from './routes/ping.js';
import { previewIndexGet } from './routes/preview.index.js';
import { tilePreviewGet } from './routes/preview.js';
Expand Down Expand Up @@ -102,6 +103,9 @@ handler.router.get('/v1/preview/:tileSet/:tileMatrix/:z/:lon/:lat/:outputType',
handler.router.get('/v1/@:location', previewIndexGet);
handler.router.get('/@:location', previewIndexGet);

// Link
handler.router.get('/v1/link/:tileSet', linkGet);

// Attribution
handler.router.get('/v1/tiles/:tileSet/:tileMatrix/attribution.json', tileAttributionGet);
handler.router.get('/v1/attribution/:tileSet/:tileMatrix/summary.json', tileAttributionGet);
Expand Down
114 changes: 114 additions & 0 deletions packages/lambda-tiler/src/routes/__tests__/link.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { strictEqual } from 'node:assert';
import { afterEach, describe, it } from 'node:test';

import { ConfigProviderMemory } from '@basemaps/config';
import { Epsg } from '@basemaps/geo';

import { FakeData, Imagery3857 } from '../../__tests__/config.data.js';
import { mockRequest } from '../../__tests__/xyz.util.js';
import { handler } from '../../index.js';
import { ConfigLoader } from '../../util/config.loader.js';

describe('/v1/link/:tileSet', () => {
const FakeTileSetName = 'tileset';
const config = new ConfigProviderMemory();

afterEach(() => {
config.objects.clear();
});

/**
* 3xx status responses
*/

// tileset found, is raster type, has one layer, has '3857' entry, imagery found > 302 response
it('success: redirect to pre-zoomed imagery', async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

config.put(FakeData.tileSetRaster(FakeTileSetName));
config.put(Imagery3857);

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 302);
strictEqual(res.statusDescription, 'Redirect to pre-zoomed imagery');
});

/**
* 4xx status responses
*/

// tileset not found > 404 response
it('failure: tileset not found', async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 404);
strictEqual(res.statusDescription, 'Tileset not found');
});

// tileset found, not raster type > 400 response
it('failure: tileset must be raster type', async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

config.put(FakeData.tileSetVector(FakeTileSetName));

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 400);
strictEqual(res.statusDescription, 'Tileset must be raster type');
});

// tileset found, is raster type, has more than one layer > 400 response
it('failure: too many layers', async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

const tileSet = FakeData.tileSetRaster(FakeTileSetName);

// add another layer
tileSet.layers.push(tileSet.layers[0]);

config.put(tileSet);

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 400);
strictEqual(res.statusDescription, 'Too many layers');
});

// tileset found, is raster type, has one layer, no '3857' entry > 400 response
it("failure: no imagery for '3857' projection", async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

const tileSet = FakeData.tileSetRaster(FakeTileSetName);

// delete '3857' entry
delete tileSet.layers[0][Epsg.Google.code];

config.put(tileSet);

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 400);
strictEqual(res.statusDescription, "No imagery for '3857' projection");
});

// tileset found, is raster type, has one layer, has '3857' entry, imagery not found > 400 response
it('failure: imagery not found', async (t) => {
t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));

config.put(FakeData.tileSetRaster(FakeTileSetName));

const req = mockRequest(`/v1/link/${FakeTileSetName}`);
const res = await handler.router.handle(req);

strictEqual(res.status, 400);
strictEqual(res.statusDescription, 'Imagery not found');
});
});
Loading

0 comments on commit 5ce3e0f

Please sign in to comment.