diff --git a/CHANGELOG.md b/CHANGELOG.md index 3539929..20fdbf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,17 @@ ### Fixed +## [0.6.0] + +### Added + * Added support for multiple threads/processes [#130] * Import all runs & threads from Instruments .trace files instead of just main thread from selected run [#130] ### Fixed +* Ensure the JSON schema has actual contents [#133] + ## [0.5.1] - 2018-08-09 ### Fixed diff --git a/README-ADMINS.md b/README-ADMINS.md new file mode 100644 index 0000000..6b3bbad --- /dev/null +++ b/README-ADMINS.md @@ -0,0 +1,72 @@ +This document describes processes needed by admins of this repository. + +# Publishing + +Publishing speedscope is a multi-step process: + +1. Test the release +2. Prepare the release +3. Publish to npm +4. Deploy the website + +At time of writing, deployment assumes you're running macOS. It probably +works if you're on a linux, and almost definitely does not work on Windows. + +## Test the release + +Speedscope is tested in CI, so all the automated tests should be passing. We'll +just be doing a few sanity checks to make sure the build & deployment machinery is working correctly. + +Run `scripts/prepare-test-installation.sh`. This will do a mock publish & +installation to ensure that the version we're about to publish is going to +work. At the end of this command, it should echo a `cd` command to run in your shell +to switch to the installation directory. Something like this: + +``` +Run the following command to switch into the test directory +cd /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-test-installation.9Ssdd2PZ/package +``` + +Run this command, to switch to the test directory. + +Inside of here, run `bin/cli.js`. This should open a copy of speedscope in browser. +Try importing a profile from disk via the browse button and make sure it works. + +Next, try running `bin/cli.js dist/release/perf-vertx*`. This should immediately open +speedscope in browser, and the perf-vertx file should load immediately. + +If everything looks good, proceed to "Prepare the release". + +## Prepare the release + +1. Update the version manually in package.json (we intentionally don't use the `npm version` command) +2. Update CHANGELOG.md to indicate the changes that were made as part of this release +3. Commit the changes with the version name as the commit message, e.g. `git commit -m 0.6.0` +4. `git tag` the release. We use tags like `v0.6.0`, e.g. `git tag v0.6.0` +5. `git push` + +## Publish to npm + +Assuming everything went well in the previous two phases, publishing should just be +a matter of running `npm publish`. + +## Deploying the website + +https://www.speedscope.app/ is hosted on GitHub pages, and is published via pushing +to the `gh-pages` branch. The `gh-pages` branch has totally different contents than +other branches of this repository: https://github.com/jlfwong/speedscope/tree/gh-pages. + +It's populated by a deploy script which is invoked by running `npm run deploy` script. +This will do a build of the static resources, and boot a local server for you to test +the compiled assets. Please do not skip the manual testing in this step. + +If everything looks good, you should be able to hit Ctrl+C, and you should see this prompt: + +``` +Commit release? [yes/no]: +``` + +If everything looks good, type `yes` then enter. This will commit to the `gh-pages` branch, and the site should automatically deploy shortly after. + +To check if a deploy has happened, you can check https://www.speedscope.app/release.txt +which includes the version, the date, and the commit of the deploy. diff --git a/package.json b/package.json index 9f17f01..1a6e80c 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,8 @@ "test": "tsc --noEmit && npm run lint && npm run coverage", "serve": "parcel assets/index.html --open --no-autoinstall" }, - "files": [ - "bin/cli.js", - "dist/release/**", - "!*.map" - ], - "browserslist": [ - "last 2 Chrome versions", - "last 2 Firefox versions" - ], + "files": ["bin/cli.js", "dist/release/**", "!*.map"], + "browserslist": ["last 2 Chrome versions", "last 2 Firefox versions"], "author": "", "license": "MIT", "devDependencies": { @@ -58,17 +51,8 @@ "^.+\\.tsx?$": "ts-jest" }, "testRegex": "\\.test\\.tsx?$", - "collectCoverageFrom": [ - "**/*.{ts,tsx}", - "!**/*.d.{ts,tsx}" - ], - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx", - "json" - ] + "collectCoverageFrom": ["**/*.{ts,tsx}", "!**/*.d.{ts,tsx}"], + "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"] }, "dependencies": { "opn": "5.3.0" diff --git a/scripts/build-release.sh b/scripts/build-release.sh index e0f93bf..788987a 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Fail on first error -set -e +set -euxo pipefail + OUTDIR=`pwd`/dist/release # Typecheck @@ -12,7 +12,8 @@ rm -rf "$OUTDIR" mkdir -p "$OUTDIR" # Place info about the current commit into the build dir to easily identify releases -date > "$OUTDIR"/release.txt +npm ls -depth -1 | head -n 1 | cut -d' ' -f 1 > "$OUTDIR"/release.txt +date >> "$OUTDIR"/release.txt git rev-parse HEAD >> "$OUTDIR"/release.txt # Place a json schema for the file format into the build directory too diff --git a/scripts/deploy.sh b/scripts/deploy.sh index a360106..535310b 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -4,8 +4,7 @@ # repository into a temporary directory and copy the release build # artifacts into there to commit & push to the gh-pages branch -# Fail on first error -set -e +set -euxo pipefail OUTDIR=`pwd`/dist/release echo $OUTDIR @@ -29,7 +28,10 @@ echo www.speedscope.app > CNAME # Set up a handler to run on Ctrl+C trap ctrl_c INT function ctrl_c() { + set +x read -p "Commit release? [yes/no]: " + set -x + if [[ $REPLY =~ ^yes$ ]] then git add --all @@ -39,7 +41,10 @@ function ctrl_c() { rm -rf "$TMPDIR" exit 0 else + set +x echo "Aborting release." + set -x + popd rm -rf "$TMPDIR" exit 1 @@ -47,6 +52,7 @@ function ctrl_c() { } # Start a local server for verification of the build +set +x echo echo echo "Build complete. Starting server on http://localhost:4444/" @@ -54,3 +60,4 @@ echo "Hit Ctrl+C to complete or cancel the release" echo echo python -m SimpleHTTPServer 4444 . +set +x diff --git a/scripts/prepare-test-installation.sh b/scripts/prepare-test-installation.sh new file mode 100755 index 0000000..fd72dd2 --- /dev/null +++ b/scripts/prepare-test-installation.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Prepare a mock installation of speedscope to test it before the actual npm +# publish + +set -euxo pipefail + +TMPDIR=`mktemp -d -t speedscope-test-installation` +PACKEDNAME=`npm pack | tail -n1` + +mv "$PACKEDNAME" "$TMPDIR" +cd "$TMPDIR" +tar -xvvf "$PACKEDNAME" +cd package +npm install + +set +x +echo +echo "Run the following command to switch into the test directory" +echo cd "$TMPDIR"/package \ No newline at end of file