Skip to content

Commit

Permalink
ci: add windows/mac osx build pipelines (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha authored Mar 2, 2021
1 parent cf42808 commit d9f6720
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 30 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,48 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 12.x
uses: actions/setup-node@v2.1.4
with:
node-version: "12.x"
registry-url: https://registry.npmjs.org

- name: Check Dependencies
run: node scripts/detect.unlinked.dep.js

- name: Install
run: yarn --frozen-lockfile --check-files

- name: Audit
run: npx check-audit --yarn

- name: Build
run: yarn run build

- name: Lint
run: yarn run lint

- name: Check Formatting
run: git diff --exit-code

- name: Test
run: yarn run test

- name: Benchmark
run: yarn run benchmark

deploy:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"license": "MIT",
"scripts": {
"lint": "eslint 'packages/*/src/**/*.ts' --quiet --fix --report-unused-disable-directives",
"test": "lerna run test --stream",
"lint": "eslint \"packages/*/src/**/*.ts\" --quiet --fix --report-unused-disable-directives",
"test": "cross-env NODE_OPTIONS=--enable-source-maps lerna run test --parallel",
"benchmark": "ospec 'packages/*/build/**/*.benchmark.js'",
"clean": "tsc -b --clean && rimraf 'packages/*/build' && yarn clean:dist",
"clean:dist": "rimraf 'packages/*/dist' && rimraf 'packages/_infra/cdk.out'",
Expand All @@ -24,6 +24,7 @@
"@types/node": "^14.11.2",
"@types/ospec": "^4.0.2",
"@types/sinon": "^9.0.5",
"cross-env": "^7.0.3",
"esbuild": "^0.8.0",
"eslint-plugin-prettier": "^3.1.4",
"lerna": "^3.20.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/_infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"deploy:synth": "cdk synth",
"deploy:diff": "cdk diff || true",
"deploy:deploy": "cdk deploy '*' -y --require-approval never",
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"devDependencies": {
"@aws-cdk/aws-batch": ">=1.70.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/attribution/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js",
"test": "ospec --globs 'build/**/*.test.js'",
"bundle": "../../scripts/bundle.js package.json"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bathymetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"build": "tsc",
"bundle": "../../scripts/bundle.js package.json",
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"bundle": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/lambda-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@linzjs/s3fs": "^4.20.0"
},
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js",
"test": "ospec --globs 'build/**/*.test.js'",
"bundle": "../../scripts/bundle.js package.json"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/lambda-api-tracker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@basemaps/shared": "^4.20.0"
},
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js",
"test": "ospec --globs 'build/**/*.test.js'",
"bundle": "../../scripts/bundle.js package.json"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/lambda-tiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
]
},
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js",
"test": "ospec --globs 'build/**/*.test.js'",
"bundle": "./bundle.sh"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/lambda-tiler/src/routes/__test__/health.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ o.spec('health', () => {
const testTileFile2 = fs.readFileSync(testTileName2);
Response2.buffer(testTileFile2);

o('Should good response', async () => {
o('Should give a 200 response', async () => {
o.timeout(500);
// Given ... a series good get tile response
const callback = sinon.stub(Tile, 'tile');
callback.onCall(0).resolves(Response1);
Expand All @@ -61,6 +62,7 @@ o.spec('health', () => {
});

o('Should return mis-match tile response', async () => {
o.timeout(500);
// Given ... a bad get tile response for second get tile
const callback = sinon.stub(Tile, 'tile');
callback.onCall(0).resolves(Response1);
Expand Down
2 changes: 1 addition & 1 deletion packages/lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"dependencies": {
"@basemaps/shared": "^4.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js",
"test": "ospec --globs 'build/**/*.test.js'",
"start": "TILE_HOST=${TILE_HOST:-https://dev.basemaps.linz.govt.nz} nodemon ../../scripts/bundle.js -e 'ts html css' -i 'dist/*' -- package.json",
"bundle": "../../scripts/bundle.js package.json",
"deploy:deploy": "node scripts/deploy.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/linzjs-docker-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/linzjs-geojson/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/linzjs-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/metrics.js",
"types": "./build/metrics.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/linzjs-s3fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"publishConfig": {
"access": "public"
Expand Down
10 changes: 7 additions & 3 deletions packages/linzjs-s3fs/src/__tests__/file.local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import o from 'ospec';
import { FsLocal } from '../file.local';
import { CompositeError } from '../composite.error';
import { S3Fs } from '..';
import * as path from 'path';

o.spec('FileLocal', () => {
const RootFolder = process.platform === 'darwin' ? '/var/root' : '/root';
const s3fs = new S3Fs();
const localFs = new FsLocal();
o('Should capture not found errors:list', async () => {
Expand Down Expand Up @@ -37,8 +39,9 @@ o.spec('FileLocal', () => {
});

o('Should capture permission errors:list', async () => {
if (process.platform === 'darwin') return;
try {
await s3fs.toArray(localFs.list('/root/test'));
await s3fs.toArray(localFs.list(path.join(RootFolder, 'test')));
throw new Error('Failed to throw');
} catch (e) {
o(CompositeError.isCompositeError(e)).equals(true);
Expand All @@ -48,7 +51,7 @@ o.spec('FileLocal', () => {

o('Should capture permission errors:write', async () => {
try {
await localFs.write('/root/test', Buffer.from('foobar'), false);
await localFs.write(path.join(RootFolder, 'test'), Buffer.from('foobar'), false);
throw new Error('Failed to throw');
} catch (e) {
o(CompositeError.isCompositeError(e)).equals(true);
Expand All @@ -57,8 +60,9 @@ o.spec('FileLocal', () => {
});

o('Should capture permission errors:read', async () => {
if (process.platform === 'darwin') return;
try {
await localFs.read('/root/test');
await localFs.read(path.join(RootFolder, 'test'));
throw new Error('Failed to throw');
} catch (e) {
o(CompositeError.isCompositeError(e)).equals(true);
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"dependencies": {
"@basemaps/geo": "^4.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tiler-sharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"dependencies": {
"@basemaps/geo": "^4.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "ospec --globs 'build/**/*.test.js' --preload ../../scripts/test.before.js"
"test": "ospec --globs 'build/**/*.test.js'"
},
"dependencies": {
"@basemaps/geo": "^4.20.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/detect.unlinked.dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getAllImports(path) {
const data = cp.execSync(`grep -R "'@basemaps" ${path}/src || true`).toString().split('\n');

for (const line of data) {
const pkgName = line.split(' ').pop().replace(/[';]/g, '');
const pkgName = line.split(' ').pop().replace(/[';]/g, '').trim();

if (pkgName.length > 0) allImports.add(pkgName);
}
Expand Down
4 changes: 0 additions & 4 deletions scripts/test.before.js

This file was deleted.

9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3159,6 +3159,13 @@ crc@^3.4.4:
dependencies:
buffer "^5.1.0"

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^6.0.0:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
Expand All @@ -3170,7 +3177,7 @@ cross-spawn@^6.0.0:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.2:
cross-spawn@^7.0.1, cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down

0 comments on commit d9f6720

Please sign in to comment.