Skip to content

Commit

Permalink
feat(cogify): improve cogify (#2800)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha authored Jun 19, 2023
1 parent 76a77ae commit cb16a44
Show file tree
Hide file tree
Showing 20 changed files with 461 additions and 127 deletions.
9 changes: 7 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ labels: bug
---

### Bug Description

A clear and concise description of what the bug is and what you expected to happen.

#### Steps to Reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

#### Desktop
- Environment: [e.g. Windows / DaaS / Ubuntu]
- Relevant Software Versions [e.g. QGIS 2.18.21]

- Environment: [e.g. Windows / DaaS / Ubuntu]
- Relevant Software Versions [e.g. QGIS 2.18.21]

#### Screenshots

If applicable, add screenshots to help explain your problem.

**Add an _Assignee_, _Milestone_, _Release_ and any relevant _Labels_.**
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
name: Feature request
about: Suggest an idea for this project
labels: enhancement

---

### User Story

In order to [accomplish goal] as a [role] I want [capability]
In order to [accomplish goal] as a [role] I want [capability]
(optional: instead of [existing behaviour]).

#### Acceptance Criteria

- [ ] ...
- [ ] ...
- [ ] ...
Expand Down
26 changes: 13 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
ignore:
- dependency-name: '@aws-cdk/*'
- dependency-name: 'aws-cdk'
- dependency-name: 'aws-sdk'
open-pull-requests-limit: 10
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: daily
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
ignore:
- dependency-name: '@aws-cdk/*'
- dependency-name: 'aws-cdk'
- dependency-name: 'aws-sdk'
open-pull-requests-limit: 10
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Code Scanning - Action"
name: 'Code Scanning - Action'

on:
on:
push:
branches:
- master
- master

jobs:
CodeQL-Build:
Expand All @@ -25,4 +25,4 @@ jobs:
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
14 changes: 7 additions & 7 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
npx lerna run bundle --stream
npm pack --workspaces
env:
NODE_ENV: "production"
NODE_ENV: 'production'

- name: Set up Docker Qemu
id: qemu
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: "@basemaps/cli - Build and push"
- name: '@basemaps/cli - Build and push'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand All @@ -64,7 +64,7 @@ jobs:
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:') == false}}

- name: "@basemaps/cli - Build and push Major/Minor"
- name: '@basemaps/cli - Build and push Major/Minor'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand All @@ -78,17 +78,17 @@ jobs:
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

- name: "@basemaps/server - Build and push"
- name: '@basemaps/server - Build and push'
uses: docker/build-push-action@v3
with:
context: packages/server
platforms: linux/arm64,linux/amd64
tags: |
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:') == false}}

- name: "@basemaps/server - Build and push Major/Minor"
- name: '@basemaps/server - Build and push Major/Minor'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
CURRENT_VERSION=$(node -p "require('./lerna.json').version")
git tag v${CURRENT_VERSION} -m v${CURRENT_VERSION}
git push --tags
- name: Deploy - Bundle
if: github.ref != 'refs/heads/master' || github.repository != 'linz/basemaps'
run: npx lerna run bundle --stream
Expand All @@ -58,7 +56,7 @@ jobs:
env:
SPLIT_IO_KEY: ${{secrets.SPLIT_IO_KEY_NON_PROD}}
GOOGLE_ANALYTICS: ${{secrets.GOOGLE_ANALYTICS_NON_PROD}}
NODE_ENV: "dev"
NODE_ENV: 'dev'

- name: (NonProd) After Deploy Smoke Test
if: github.ref == 'refs/heads/master' && github.repository == 'linz/basemaps'
Expand All @@ -82,7 +80,7 @@ jobs:
cp *.tgz packages/cli
npx lerna run deploy:deploy --stream
env:
NODE_ENV: "production"
NODE_ENV: 'production'
GOOGLE_ANALYTICS: ${{secrets.GOOGLE_ANALYTICS_PROD}}
SPLIT_IO_KEY: ${{secrets.SPLIT_IO_KEY_PROD}}

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/screenshot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: screenshot

on:
on:
pull_request:
push:
branches:
Expand All @@ -24,24 +24,24 @@ jobs:
npx lerna run bundle --stream
npm pack --workspaces
env:
NODE_ENV: "production"
NODE_ENV: 'production'

- name: (NonProd) Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_SCREENSHOT }}

- name: (Screenshot) Screenshot Pull Request Changes
run: |
./packages/cli/bin/bmc.js serve --config s3://linz-basemaps/config/config-latest.json.gz &
# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false
docker run --rm --network="host" -v $PWD:$PWD ghcr.io/linz/basemaps-screenshot/cli:v1 --url http://localhost:5000 --output $PWD/.artifacts/visual-snapshots
- name: Save snapshots
uses: getsentry/action-visual-snapshot@v2
with:
Expand Down Expand Up @@ -70,5 +70,5 @@ jobs:
id: visual-snapshots-diff
uses: blacha/action-visual-snapshot@v2
with:
storage-prefix: "s3://linz-basemaps-screenshot"
storage-url: "https://d25mfjh9syaxsr.cloudfront.net"
storage-prefix: 's3://linz-basemaps-screenshot'
storage-url: 'https://d25mfjh9syaxsr.cloudfront.net'
10 changes: 8 additions & 2 deletions packages/cli/src/cli/overview/action.create.overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ export class CommandCreateOverview extends CommandLineAction {
const st = new SimpleTimer();
logger.debug({ source }, 'CreateOverview:ListTiffs');
const tiffList = (await fsa.toArray(fsa.list(source))).filter(filterTiff);
if (tiffList.length === 0) {
logger.warn('CreateOverview:NoTiffs');
return;
}
const tiffSource = tiffList.map((path: string) => fsa.source(path));

logger.info({ source, duration: st.tick() }, 'CreateOverview:ListTiffs:Done');
logger.info({ source, tiffs: tiffList.length, duration: st.tick() }, 'CreateOverview:ListTiffs:Done');
logger.debug({ source, first: tiffSource[0].uri }, 'CreateOverview:PrepareSourceFiles');
// To ensure that permissions are setup correctly attempt to read the first tiff
await fsa.head(tiffSource[0].uri);

logger.debug({ source }, 'CreateOverview:PrepareSourceFiles');
const tiff: CogTiff = new CogTiff(tiffSource[0]);
await tiff.init(true);
const tileMatrix = await this.getTileMatrix(tiff);
Expand Down
4 changes: 4 additions & 0 deletions packages/cogify/src/argo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Is this script running inside of argo */
export function isArgo(): boolean {
return process.env['ARGO_NODE_ID'] != null;
}
2 changes: 2 additions & 0 deletions packages/cogify/src/cogify/cli.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { subcommands } from 'cmd-ts';
import { BasemapsCogifyCreateCommand } from './cli/cli.cog.js';
import { BasemapsCogifyCoverCommand } from './cli/cli.cover.js';
import { BasemapsCogifyConfigCommand } from './cli/cli.config.js';

export const CogifyCli = subcommands({
name: 'cogify',
cmds: {
cover: BasemapsCogifyCoverCommand,
create: BasemapsCogifyCreateCommand,
config: BasemapsCogifyConfigCommand,
},
});
Loading

0 comments on commit cb16a44

Please sign in to comment.