mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
commit
d6c4450b1c
@ -23,7 +23,7 @@ workflows:
|
|||||||
requires:
|
requires:
|
||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
- prep-build
|
- prep-build
|
||||||
- job-announce:
|
- job-publish:
|
||||||
requires:
|
requires:
|
||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
- prep-build
|
- prep-build
|
||||||
@ -67,7 +67,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Install deps via npm
|
name: Install deps via npm
|
||||||
command: npm install
|
command: npm install
|
||||||
@ -75,6 +75,10 @@ jobs:
|
|||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ checksum "package-lock.json" }}
|
||||||
paths:
|
paths:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
- save_cache:
|
||||||
|
key: dependency-cache-{{ .Revision }}
|
||||||
|
paths:
|
||||||
|
- node_modules
|
||||||
|
|
||||||
prep-deps-firefox:
|
prep-deps-firefox:
|
||||||
docker:
|
docker:
|
||||||
@ -97,7 +101,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: build:dist
|
name: build:dist
|
||||||
command: npm run dist
|
command: npm run dist
|
||||||
@ -116,7 +120,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Get Scss Cache key
|
name: Get Scss Cache key
|
||||||
# this allows us to checksum against a whole directory
|
# this allows us to checksum against a whole directory
|
||||||
@ -135,7 +139,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Test
|
name: Test
|
||||||
command: npm run lint
|
command: npm run lint
|
||||||
@ -146,7 +150,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: build-cache-{{ .Revision }}
|
key: build-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
@ -162,7 +166,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: build-cache-{{ .Revision }}
|
key: build-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
@ -173,13 +177,13 @@ jobs:
|
|||||||
paths:
|
paths:
|
||||||
- test-artifacts
|
- test-artifacts
|
||||||
|
|
||||||
job-announce:
|
job-publish:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:8-browsers
|
- image: circleci/node:8-browsers
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: build-cache-{{ .Revision }}
|
key: build-cache-{{ .Revision }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
@ -187,6 +191,9 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: dist/mascara
|
path: dist/mascara
|
||||||
destination: builds/mascara
|
destination: builds/mascara
|
||||||
|
- store_artifacts:
|
||||||
|
path: dist/sourcemaps
|
||||||
|
destination: builds/sourcemaps
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: builds
|
path: builds
|
||||||
destination: builds
|
destination: builds
|
||||||
@ -196,6 +203,9 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: build:announce
|
name: build:announce
|
||||||
command: ./development/metamaskbot-build-announce.js
|
command: ./development/metamaskbot-build-announce.js
|
||||||
|
- run:
|
||||||
|
name: sentry sourcemaps upload
|
||||||
|
command: npm run sentry:publish
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
docker:
|
docker:
|
||||||
@ -203,7 +213,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: test:coverage
|
name: test:coverage
|
||||||
command: npm run test:coverage
|
command: npm run test:coverage
|
||||||
@ -225,7 +235,7 @@ jobs:
|
|||||||
&& sudo mv /usr/bin/firefox /usr/bin/firefox-old
|
&& sudo mv /usr/bin/firefox /usr/bin/firefox-old
|
||||||
&& sudo ln -s /opt/firefox58/firefox /usr/bin/firefox
|
&& sudo ln -s /opt/firefox58/firefox /usr/bin/firefox
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Get Scss Cache key
|
name: Get Scss Cache key
|
||||||
# this allows us to checksum against a whole directory
|
# this allows us to checksum against a whole directory
|
||||||
@ -244,7 +254,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Get Scss Cache key
|
name: Get Scss Cache key
|
||||||
# this allows us to checksum against a whole directory
|
# this allows us to checksum against a whole directory
|
||||||
@ -272,7 +282,7 @@ jobs:
|
|||||||
&& sudo mv /usr/bin/firefox /usr/bin/firefox-old
|
&& sudo mv /usr/bin/firefox /usr/bin/firefox-old
|
||||||
&& sudo ln -s /opt/firefox58/firefox /usr/bin/firefox
|
&& sudo ln -s /opt/firefox58/firefox /usr/bin/firefox
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Get Scss Cache key
|
name: Get Scss Cache key
|
||||||
# this allows us to checksum against a whole directory
|
# this allows us to checksum against a whole directory
|
||||||
@ -291,7 +301,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: dependency-cache-{{ checksum "package-lock.json" }}
|
key: dependency-cache-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: Get Scss Cache key
|
name: Get Scss Cache key
|
||||||
# this allows us to checksum against a whole directory
|
# this allows us to checksum against a whole directory
|
||||||
|
@ -1,51 +1,62 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const request = require('request-promise')
|
const request = require('request-promise')
|
||||||
const { version } = require('../dist/chrome/manifest.json')
|
const VERSION = require('../dist/chrome/manifest.json').version
|
||||||
|
|
||||||
const GITHUB_COMMENT_TOKEN = process.env.GITHUB_COMMENT_TOKEN
|
start().catch(console.error)
|
||||||
const CIRCLE_PULL_REQUEST = process.env.CIRCLE_PULL_REQUEST
|
|
||||||
console.log('CIRCLE_PULL_REQUEST', CIRCLE_PULL_REQUEST)
|
|
||||||
const CIRCLE_SHA1 = process.env.CIRCLE_SHA1
|
|
||||||
console.log('CIRCLE_SHA1', CIRCLE_SHA1)
|
|
||||||
const CIRCLE_BUILD_NUM = process.env.CIRCLE_BUILD_NUM
|
|
||||||
console.log('CIRCLE_BUILD_NUM', CIRCLE_BUILD_NUM)
|
|
||||||
|
|
||||||
const CIRCLE_PR_NUMBER = CIRCLE_PULL_REQUEST.split('/').pop()
|
async function start() {
|
||||||
const SHORT_SHA1 = CIRCLE_SHA1.slice(0,7)
|
|
||||||
const BUILD_LINK_BASE = `https://${CIRCLE_BUILD_NUM}-42009758-gh.circle-artifacts.com/0`
|
|
||||||
|
|
||||||
const MASCARA = `${BUILD_LINK_BASE}/builds/mascara/home.html`
|
const GITHUB_COMMENT_TOKEN = process.env.GITHUB_COMMENT_TOKEN
|
||||||
const CHROME = `${BUILD_LINK_BASE}/builds/metamask-chrome-${version}.zip`
|
const CIRCLE_PULL_REQUEST = process.env.CIRCLE_PULL_REQUEST
|
||||||
const FIREFOX = `${BUILD_LINK_BASE}/builds/metamask-firefox-${version}.zip`
|
console.log('CIRCLE_PULL_REQUEST', CIRCLE_PULL_REQUEST)
|
||||||
const EDGE = `${BUILD_LINK_BASE}/builds/metamask-edge-${version}.zip`
|
const CIRCLE_SHA1 = process.env.CIRCLE_SHA1
|
||||||
const OPERA = `${BUILD_LINK_BASE}/builds/metamask-opera-${version}.zip`
|
console.log('CIRCLE_SHA1', CIRCLE_SHA1)
|
||||||
const WALKTHROUGH = `${BUILD_LINK_BASE}/test-artifacts/screens/walkthrough%20%28en%29.gif`
|
const CIRCLE_BUILD_NUM = process.env.CIRCLE_BUILD_NUM
|
||||||
|
console.log('CIRCLE_BUILD_NUM', CIRCLE_BUILD_NUM)
|
||||||
|
|
||||||
const commentBody = `
|
if (!CIRCLE_PULL_REQUEST) {
|
||||||
<details>
|
console.warn(`No pull request detected for commit "${CIRCLE_SHA1}"`)
|
||||||
<summary>
|
return
|
||||||
Builds ready [${SHORT_SHA1}]:
|
}
|
||||||
<a href="${MASCARA}">mascara</a>,
|
|
||||||
<a href="${CHROME}">chrome</a>,
|
|
||||||
<a href="${FIREFOX}">firefox</a>,
|
|
||||||
<a href="${EDGE}">edge</a>,
|
|
||||||
<a href="${OPERA}">opera</a>
|
|
||||||
</summary>
|
|
||||||
<image src="${WALKTHROUGH}">
|
|
||||||
</details>
|
|
||||||
`
|
|
||||||
|
|
||||||
const JSON_PAYLOAD = JSON.stringify({ body: commentBody })
|
const CIRCLE_PR_NUMBER = CIRCLE_PULL_REQUEST.split('/').pop()
|
||||||
const POST_COMMENT_URI = `https://api.github.com/repos/metamask/metamask-extension/issues/${CIRCLE_PR_NUMBER}/comments`
|
const SHORT_SHA1 = CIRCLE_SHA1.slice(0,7)
|
||||||
console.log(`Announcement:\n${commentBody}`)
|
const BUILD_LINK_BASE = `https://${CIRCLE_BUILD_NUM}-42009758-gh.circle-artifacts.com/0`
|
||||||
console.log(`Posting to: ${POST_COMMENT_URI}`)
|
|
||||||
|
|
||||||
request({
|
const MASCARA = `${BUILD_LINK_BASE}/builds/mascara/home.html`
|
||||||
method: 'POST',
|
const CHROME = `${BUILD_LINK_BASE}/builds/metamask-chrome-${VERSION}.zip`
|
||||||
uri: POST_COMMENT_URI,
|
const FIREFOX = `${BUILD_LINK_BASE}/builds/metamask-firefox-${VERSION}.zip`
|
||||||
body: JSON_PAYLOAD,
|
const EDGE = `${BUILD_LINK_BASE}/builds/metamask-edge-${VERSION}.zip`
|
||||||
headers: {
|
const OPERA = `${BUILD_LINK_BASE}/builds/metamask-opera-${VERSION}.zip`
|
||||||
'User-Agent': 'metamaskbot',
|
const WALKTHROUGH = `${BUILD_LINK_BASE}/test-artifacts/screens/walkthrough%20%28en%29.gif`
|
||||||
'Authorization': `token ${GITHUB_COMMENT_TOKEN}`,
|
|
||||||
},
|
const commentBody = `
|
||||||
})
|
<details>
|
||||||
|
<summary>
|
||||||
|
Builds ready [${SHORT_SHA1}]:
|
||||||
|
<a href="${MASCARA}">mascara</a>,
|
||||||
|
<a href="${CHROME}">chrome</a>,
|
||||||
|
<a href="${FIREFOX}">firefox</a>,
|
||||||
|
<a href="${EDGE}">edge</a>,
|
||||||
|
<a href="${OPERA}">opera</a>
|
||||||
|
</summary>
|
||||||
|
<image src="${WALKTHROUGH}">
|
||||||
|
</details>
|
||||||
|
`
|
||||||
|
|
||||||
|
const JSON_PAYLOAD = JSON.stringify({ body: commentBody })
|
||||||
|
const POST_COMMENT_URI = `https://api.github.com/repos/metamask/metamask-extension/issues/${CIRCLE_PR_NUMBER}/comments`
|
||||||
|
console.log(`Announcement:\n${commentBody}`)
|
||||||
|
console.log(`Posting to: ${POST_COMMENT_URI}`)
|
||||||
|
|
||||||
|
await request({
|
||||||
|
method: 'POST',
|
||||||
|
uri: POST_COMMENT_URI,
|
||||||
|
body: JSON_PAYLOAD,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'metamaskbot',
|
||||||
|
'Authorization': `token ${GITHUB_COMMENT_TOKEN}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
55
development/sentry-publish.js
Normal file
55
development/sentry-publish.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
const pify = require('pify')
|
||||||
|
const exec = pify(require('child_process').exec, { multiArgs: true })
|
||||||
|
const VERSION = require('../dist/chrome/manifest.json').version
|
||||||
|
|
||||||
|
start().catch(console.error)
|
||||||
|
|
||||||
|
async function start(){
|
||||||
|
const authWorked = await checkIfAuthWorks()
|
||||||
|
if (!authWorked) {
|
||||||
|
console.log(`Sentry auth failed...`)
|
||||||
|
}
|
||||||
|
// check if version exists or not
|
||||||
|
const versionAlreadyExists = await checkIfVersionExists()
|
||||||
|
// abort if versions exists
|
||||||
|
if (versionAlreadyExists) {
|
||||||
|
console.log(`Version "${VERSION}" already exists on Sentry, aborting sourcemap upload.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// create sentry release
|
||||||
|
console.log(`creating Sentry release for "${VERSION}"...`)
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`)
|
||||||
|
console.log(`removing any existing files from Sentry release "${VERSION}"...`)
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`)
|
||||||
|
// upload sentry source and sourcemaps
|
||||||
|
console.log(`uploading source files Sentry release "${VERSION}"...`)
|
||||||
|
await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`)
|
||||||
|
console.log(`uploading sourcemaps Sentry release "${VERSION}"...`)
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`)
|
||||||
|
console.log('all done!')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkIfAuthWorks() {
|
||||||
|
const itWorked = await doesNotFail(async () => {
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' list`)
|
||||||
|
})
|
||||||
|
return itWorked
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkIfVersionExists() {
|
||||||
|
const versionAlreadyExists = await doesNotFail(async () => {
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' info ${VERSION}`)
|
||||||
|
})
|
||||||
|
return versionAlreadyExists
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doesNotFail(asyncFn) {
|
||||||
|
try {
|
||||||
|
await asyncFn()
|
||||||
|
return true
|
||||||
|
} catch (err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -188,7 +188,7 @@
|
|||||||
"integrity": "sha1-AtD3eBwe5eG+WkMSoyX76LGzcjE=",
|
"integrity": "sha1-AtD3eBwe5eG+WkMSoyX76LGzcjE=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"https-proxy-agent": "2.2.0",
|
"https-proxy-agent": "2.2.1",
|
||||||
"node-fetch": "1.7.3",
|
"node-fetch": "1.7.3",
|
||||||
"progress": "2.0.0",
|
"progress": "2.0.0",
|
||||||
"proxy-from-env": "1.0.0"
|
"proxy-from-env": "1.0.0"
|
||||||
@ -213,9 +213,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"https-proxy-agent": {
|
"https-proxy-agent": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
|
||||||
"integrity": "sha512-uUWcfXHvy/dwfM9bqa6AozvAjS32dZSTUYd/4SEpYKRg6LEcPLshksnQYRudM9AyNvUARMfAg5TLjUDyX/K4vA==",
|
"integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"agent-base": "4.2.0",
|
"agent-base": "4.2.0",
|
||||||
|
@ -31,13 +31,7 @@
|
|||||||
"test:mascara:build:background": "browserify mascara/src/background.js -o dist/mascara/background.js",
|
"test:mascara:build:background": "browserify mascara/src/background.js -o dist/mascara/background.js",
|
||||||
"test:mascara:build:tests": "browserify test/integration/lib/first-time.js -o dist/mascara/tests.js",
|
"test:mascara:build:tests": "browserify test/integration/lib/first-time.js -o dist/mascara/tests.js",
|
||||||
"ganache:start": "ganache-cli -m 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'",
|
"ganache:start": "ganache-cli -m 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'",
|
||||||
"sentry": "export RELEASE=`cat app/manifest.json| jq -r .version` && npm run sentry:release && npm run sentry:upload",
|
"sentry:publish": "node ./development/sentry-publish.js",
|
||||||
"sentry:release": "npm run sentry:release:new && npm run sentry:release:clean",
|
|
||||||
"sentry:release:new": "sentry-cli releases --org 'metamask' --project 'metamask' new $RELEASE",
|
|
||||||
"sentry:release:clean": "sentry-cli releases --org 'metamask' --project 'metamask' files $RELEASE delete --all",
|
|
||||||
"sentry:upload": "npm run sentry:upload:source && npm run sentry:upload:maps",
|
|
||||||
"sentry:upload:source": "for FILEPATH in ./dist/chrome/scripts/*.js; do [ -e $FILEPATH ] || continue; export FILE=`basename $FILEPATH` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files $RELEASE upload $FILEPATH metamask/scripts/$FILE; done;",
|
|
||||||
"sentry:upload:maps": "sentry-cli releases --org 'metamask' --project 'metamask' files $RELEASE upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps' --rewrite",
|
|
||||||
"lint": "gulp lint",
|
"lint": "gulp lint",
|
||||||
"lint:fix": "gulp lint:fix",
|
"lint:fix": "gulp lint:fix",
|
||||||
"ui": "npm run test:flat:build:states && beefy development/ui-dev.js:bundle.js --live --open --index=./development/index.html --cwd ./",
|
"ui": "npm run test:flat:build:states && beefy development/ui-dev.js:bundle.js --live --open --index=./development/index.html --cwd ./",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user