From a5c31848804e5466b466e2a9ea80424c9a27bc0f Mon Sep 17 00:00:00 2001 From: Jamie Wong Date: Tue, 21 Aug 2018 20:11:00 -0700 Subject: [PATCH] Add a way of generating a self-contained zip-file --- README-ADMINS.md | 12 +++++++++++- README.md | 9 +++++++++ scripts/prepare-zip-file.sh | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100755 scripts/prepare-zip-file.sh diff --git a/README-ADMINS.md b/README-ADMINS.md index a79cac5..b243bb1 100644 --- a/README-ADMINS.md +++ b/README-ADMINS.md @@ -8,6 +8,7 @@ Publishing speedscope is a multi-step process: 2. Prepare the release 3. Publish to npm 4. Deploy the website +5. Upload a release to GitHub 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. @@ -54,7 +55,7 @@ a matter of running `npm publish`. To verify that the publish was successful, run `npm install -g speedscope`. Try `speedscope`, which should open speedscope in browser. -Try `speedscope sample/profiles/stackcollapse/simple.txt`, which should immediately load the profile +Try `speedscope sample/profiles/stackcollapse/simple.txt`, which should immediately load the profile. ## Deploying the website @@ -76,3 +77,12 @@ If everything looks good, type `yes` then enter. This will commit to the `gh-pag 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. + +## Upload a release to GitHub + +To make a zipfile suitable for uploading to GitHub as a release, run prepare-zip-file.sh. Note that this step must follow the "Publish to npm" step, +since it uses assets from the npm publish. + +Once that's done, you should have a zip file in `dist/release/` + +Upload that file along with changelog notes to https://github.com/jlfwong/speedscope/releases/new diff --git a/README.md b/README.md index 9fd46d0..6ee79ea 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ Given raw profiling data, speedscope allows you to interactively explore the dat Visit https://www.speedscope.app, then either browse to find a profile file or drag-and-drop one onto the page. The profiles are not uploaded anywhere -- the application is totally in-browser. +## Command line usage + For offline use, or convenience in the terminal, you can also install speedscope via npm: @@ -20,6 +22,13 @@ via npm: Invoking `speedscope /path/to/profile` will load speedscope in your default browser. +## Self-contained directory + +If you don't have npm or node installed, you can also download a +self-contained version from https://github.com/jlfwong/speedscope/releases. +After you download the zip file from a release, simply unzip it and open the +contained `index.html` in Chrome or Firefox. + ## Supported file formats speedscope is designed to ingest profiles from a variety of different profilers for different programming languages & environments. Click the links below for documentation on how to import from a specific source. diff --git a/scripts/prepare-zip-file.sh b/scripts/prepare-zip-file.sh new file mode 100755 index 0000000..24f6c3a --- /dev/null +++ b/scripts/prepare-zip-file.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Prepare a mock installation of speedscope to test it before the actual npm +# publish + +set -euxo pipefail + +SRCDIR=`pwd` +TMPDIR=`mktemp -d -t speedscope-test-installation` + +# Untar the package +pushd "$TMPDIR" +PACKEDNAME=`npm pack speedscope | tail -n1` +tar -xvvf "$PACKEDNAME" + +# Zip the parts we care about +ZIPNAME=`basename $PACKEDNAME .tgz`.zip +mkdir speedscope +mv package/dist/release/** speedscope +cp "$SRCDIR"/LICENSE speedscope +echo "This is a self-contained release of https://github.com/jlfwong/speedscope." > speedscope/README +echo "To use it, open index.html in Chrome or Firefox." >> speedscope/README + +zip "$ZIPNAME" speedscope/** + +# Switch back to the repository root +popd +mv "$TMPDIR"/"$ZIPNAME" dist/release/"$ZIPNAME" + +# Clean up +rm -rf "$TMPDIR" + +set +x +echo "Created dist/release/$ZIPNAME" \ No newline at end of file