Skip to content

Commit

Permalink
Migrate github size chekcer app and aws creds to mbx-ci (#10719)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arindam Bose authored May 28, 2021
1 parent 8093b53 commit c41d41b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 108 deletions.
52 changes: 27 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Install mbx-ci
command: |
curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > ~/mbx-ci &&
chmod 755 ~/mbx-ci &&
~/mbx-ci aws setup
- restore_cache:
keys:
- v4-yarn-{{ checksum "yarn.lock" }}
Expand All @@ -133,15 +139,19 @@ jobs:
- '~/.yarn'
- 'node_modules'
- persist_to_workspace:
root: .
root: ~/
paths:
- .
- mapbox-gl-js
- .ssh
- .aws
- mbx-ci


lint:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- restore_cache:
keys:
- v2-lint-{{ .Branch }}
Expand All @@ -158,7 +168,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run: yarn run build-prod-min
- run: yarn run build-prod
- run: yarn run build-csp
Expand All @@ -171,42 +181,34 @@ jobs:
name: Check bundle size
command: |
node build/check-bundle-size.js
- deploy:
name: Trigger memory metrics when merging to main
command: |
if [ -n "${WEB_METRICS_TOKEN}" ]; then
if [[ $CIRCLE_BRANCH == main ]]; then
curl -X POST https://circleci.com/api/v1.1/project/github/mapbox/web-metrics/build?circle-token=${WEB_METRICS_TOKEN}
fi
fi
- store_artifacts:
path: "dist"
- store_artifacts:
path: "test/release"
- persist_to_workspace:
root: .
root: ~/
paths:
- dist
- mapbox-gl-js/dist

test-flow:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run: yarn run test-flow

test-unit:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run: yarn run test-unit

test-render:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-chrome
- run: yarn run test-render
- store_test_results:
Expand All @@ -218,7 +220,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-chrome
- run: yarn run test-render-prod
- store_test_results:
Expand All @@ -230,7 +232,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-chrome
- run: yarn run test-query
- store_test_results:
Expand All @@ -242,7 +244,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run:
name: Build Webpack
command: |
Expand All @@ -257,7 +259,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-chrome
- run:
name: Collect performance stats
Expand All @@ -271,7 +273,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-browser-tools
- run: yarn run build-dev
- run: yarn run build-token
Expand All @@ -292,14 +294,14 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run: yarn run test-expressions

deploy-benchmarks:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run:
name: Build
command: BENCHMARK_VERSION="${CIRCLE_TAG:-$CIRCLE_BRANCH} $(git rev-parse --short=7 HEAD)" yarn run build-benchmarks
Expand All @@ -315,7 +317,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- aws-cli/install
- run:
name: Check build file for correct SDK version
Expand Down
13 changes: 2 additions & 11 deletions build/check-bundle-size.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node

import { Octokit } from "@octokit/rest";
import { createAppAuth } from "@octokit/auth-app";
import prettyBytes from 'pretty-bytes';
import fs from 'fs';
import {execSync} from 'child_process';
Expand All @@ -14,14 +13,11 @@ process.on('unhandledRejection', error => {
process.exit(1)
});

const SIZE_CHECK_APP_ID = 14028;
const SIZE_CHECK_APP_INSTALLATION_ID = 229425;

const FILES = [
['JS', "dist/mapbox-gl.js"],
['CSS', "dist/mapbox-gl.css"]
];
const PK = process.env['SIZE_CHECK_APP_PRIVATE_KEY'];
const PK = process.env['MBX_CI_DOMAIN'];
if (!PK) {
console.log('Fork PR; not computing size.');
process.exit(0);
Expand All @@ -32,12 +28,7 @@ const repo = 'mapbox-gl-js';
(async () => {
// Initialize github client
const github = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: SIZE_CHECK_APP_ID,
privateKey: Buffer.from(PK, 'base64').toString('binary'),
installationId: SIZE_CHECK_APP_INSTALLATION_ID
}
auth: execSync('~/mbx-ci github notifier token').toString().trim()
});

//get current sizes
Expand Down
72 changes: 0 additions & 72 deletions cloudformation/ci.template

This file was deleted.

0 comments on commit c41d41b

Please sign in to comment.