Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger canary release on successful PR build #246

Merged
merged 56 commits into from Jul 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bf8942a
Setting up after_success for travisci
jonrohan Jul 7, 2017
2e44d06
removing quotes
jonrohan Jul 7, 2017
a572720
testing with deploy script
jonrohan Jul 7, 2017
9ce110d
Change provider to script
jonrohan Jul 7, 2017
50e6f4c
trying with an extra env
jonrohan Jul 7, 2017
fa38af4
on all branches
jonrohan Jul 7, 2017
a20f259
Change to the build directory
jonrohan Jul 7, 2017
29e2566
Constructing version name
jonrohan Jul 7, 2017
bdc537f
removing npm script for now
jonrohan Jul 7, 2017
a41446a
Using short commit
jonrohan Jul 7, 2017
8f443ab
Using matrix
jonrohan Jul 7, 2017
c1b119a
Abstracting out module name
jonrohan Jul 7, 2017
570b667
Creating a deploy matrix
jonrohan Jul 7, 2017
5bb4059
Don't deploy on dev or master
jonrohan Jul 7, 2017
7613846
let's do this
jonrohan Jul 7, 2017
95aac5b
removing global commit variable and installing dev dependencies
jonrohan Jul 7, 2017
b8d7aeb
Running script
jonrohan Jul 7, 2017
b482fd8
Sort these so we don't overlook any
jonrohan Jul 7, 2017
610e213
creating a dummy script to avoid failed deploy
jonrohan Jul 7, 2017
79cf276
Changing permissions on script
jonrohan Jul 7, 2017
af83807
update publish scripts
Jul 7, 2017
2b16f69
add top-level test script
Jul 7, 2017
e5a115e
just echo for now
Jul 7, 2017
2f20282
add basic branch logic
Jul 7, 2017
14c5ecb
rename 'publish' => 'release'; don't run recursively
Jul 7, 2017
908ab0e
stub out CI deployment logic
Jul 7, 2017
f71f97d
Merge branch 'dev' into after_success
shawnbot Jul 7, 2017
172f6c2
remove top-level test script for now
Jul 7, 2017
88a0b4e
rename to deploy
jonrohan Jul 7, 2017
a4d6392
rename to deploy
jonrohan Jul 7, 2017
999c6d4
skipping deploy
jonrohan Jul 7, 2017
65925c3
add back npm test script
Jul 7, 2017
89ba9a0
try testing from top level
Jul 7, 2017
4abd9bd
try bash
jonrohan Jul 8, 2017
cf82ee4
Use travis event type
jonrohan Jul 8, 2017
4bb84f8
rename deploy => cibuild
shawnbot Jul 10, 2017
03d2e1f
run all ci release commands with --yes
shawnbot Jul 10, 2017
e18e8f7
remove --skip-git lerna arg
shawnbot Jul 10, 2017
0a07d2f
upgrade to lerna@2.0.0
shawnbot Jul 10, 2017
e99ae79
authenticate npm w/NPM_TOKEN env
shawnbot Jul 11, 2017
c3abddc
call script/cibuild with --yes
shawnbot Jul 11, 2017
f40a30c
get ci_args from argv[1:]
shawnbot Jul 11, 2017
0d3f6b7
rename ci_args to args
shawnbot Jul 11, 2017
9cce630
use NPM_API_KEY instead of NPM_TOKEN
shawnbot Jul 11, 2017
d96aa3b
set --npm-tag=canary for release-canary script
shawnbot Jul 12, 2017
92656aa
add a comment to explain why we're passing args
shawnbot Jul 12, 2017
53ec496
add compare-published script
shawnbot Jul 12, 2017
c1ad972
tidy up compare-published script
shawnbot Jul 12, 2017
9991349
add caveat in compare-published
shawnbot Jul 12, 2017
d7ddfef
reorder lerna publish args
shawnbot Jul 12, 2017
b57d529
echo the rc and release commands, just to be safe
shawnbot Jul 12, 2017
871d806
disable primer/selector-no-utility
shawnbot Jul 12, 2017
7659b63
confirm travis auth
shawnbot Jul 12, 2017
ae023e0
try npm config set
shawnbot Jul 12, 2017
a9559e8
run stuff again
shawnbot Jul 12, 2017
0ce097e
nix `npm whoami` call
shawnbot Jul 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 11 additions & 30 deletions .travis.yml
@@ -1,32 +1,13 @@
language: node_js
node_js:
- '7'
env:
- TEST_DIR=modules/primer-css
- TEST_DIR=modules/primer-core
- TEST_DIR=modules/primer-product
- TEST_DIR=modules/primer-marketing
- TEST_DIR=modules/primer-alerts
- TEST_DIR=modules/primer-base
- TEST_DIR=modules/primer-blankslate
- TEST_DIR=modules/primer-box
- TEST_DIR=modules/primer-breadcrumb
- TEST_DIR=modules/primer-buttons
- TEST_DIR=modules/primer-cards
- TEST_DIR=modules/primer-forms
- TEST_DIR=modules/primer-labels
- TEST_DIR=modules/primer-layout
- TEST_DIR=modules/primer-markdown
- TEST_DIR=modules/primer-marketing
- TEST_DIR=modules/primer-marketing-type
- TEST_DIR=modules/primer-marketing-utilities
- TEST_DIR=modules/primer-navigation
- TEST_DIR=modules/primer-page-headers
- TEST_DIR=modules/primer-page-sections
- TEST_DIR=modules/primer-support
- TEST_DIR=modules/primer-table-object
- TEST_DIR=modules/primer-tables
- TEST_DIR=modules/primer-tooltips
- TEST_DIR=modules/primer-truncate
- TEST_DIR=modules/primer-utilities
script: cd $TEST_DIR && npm install && npm test
- 7

before_script:
- npm config set "//registry.npmjs.org/:_authToken=\${NPM_API_KEY}"
- lerna bootstrap

script:
- npm test

after_success:
- script/cibuild --yes
1 change: 1 addition & 0 deletions modules/primer-utilities/lib/padding.scss
Expand Up @@ -67,6 +67,7 @@
}

// responsive padding for containers
// stylelint-disable-next-line primer/selector-no-utility
.p-responsive {
padding-right: $spacer-3 !important;
padding-left: $spacer-3 !important;
Expand Down
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -3,14 +3,14 @@
"scripts": {
"bootstrap": "lerna bootstrap",
"clean": "lerna clean",
"updated": "lerna updated",
"diff": "lerna diff",
"publish": "lerna publish",
"dev": "lerna publish --npm-tag=dev --skip-git",
"rc": "lerna publish --npm-tag=rc --skip-git",
"force": "lerna publish --force-publish=*"
"updated": "lerna updated",
"release": "lerna publish",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a release will be lerna publish --yes

How does that resolve versions?

e.g.

a@1.1.0

b@2.0.0 depends on a@^1.1.0

c@3.0.0 depends on a@^1.1.0

d@4.0.0

If you merged changes to master that constitute a minor bump of:

a@1.1.0 to a@1.2.0

  • causes b@2.0.0 to become b@2.0.1
  • causes c@3.0.0 to become c@3.0.1

and a major of:

d@4.0.0 to d@5.0.0

as well as a small change of:

c@3.0.0 to c@3.0.1

How would that all get resolved non interactively?

The result needs to be:

a@1.2.0
b@2.0.1
c@3.0.1
d@5.0.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for weighing in, @bradbarrow. My hope – perhaps based on bad assumptions, which I'm more than happy to reassess – was that we could do the version resolution with lerna publish --no-npm and file a PR with the resulting versions, then have those versions published without any incrementing or prompting when the PR merges. I haven't tested this out yet, but I plan to today.

"release-candidate": "lerna publish --npm-tag=rc",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI keeping the --skip-git on release-candidate keeps the version changes locally but doesn't publish them, so when you go from release candidate to a release you don't have to force publish. If we don't do this then we'll need to add a force publish option to the scripts which I'm also not sure why you've removed in this pr. It also means we have more force publish options to consider as right now the forma script publishes every single package which we might not want to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my thinking was that we don't need --skip-git because these commands will be run on Travis, from whence we we won't commit changes or push tags.

"release-canary": "lerna publish --npm-tag=canary --canary",
"test": "lerna run test"
},
"devDependencies": {
"lerna": "^2.0.0-rc.5"
"lerna": "^2.0.0"
}
}
23 changes: 23 additions & 0 deletions script/cibuild
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

# --yes gets passed in by .travis.yml,
# which makes this easier to test locally
args=${@:1}

# always publish a canary release if this is a PR build
if [[ $TRAVIS_EVENT_TYPE = pull_request ]]; then
echo "🐦 Publishing canary version..."
npm run release-canary -- ${args}
# merges to dev build a release candidate
elif [[ $TRAVIS_BRANCH = dev ]]; then
echo "👌 Publishing release candidate..."
echo npm run release-candidate -- ${args}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the echo here and on line 19 will just output the command rather than run it. We'll need to remove those as we're ready to test those release stages.

# publish a release when we merge to master
elif [[ $TRAVIS_BRANCH = master ]]; then
echo "📦 Publishing latest release!"
echo npm run release -- ${args}
else
echo "⚠️ This isn't a PR and '${TRAVIS_BRANCH}' isn't a release branch."
exit 1
fi
23 changes: 23 additions & 0 deletions script/compare-published
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

# reads the tag either from $NPM_TAG or first positional arg:
# script/compare-published [tag]
tag=${1:-${NPM_TAG:-latest}}

# this is way faster than `lerna exec npm info . .name`
# (but will skip modules that don't have "primer-" in them)
modules=`ls -1 modules | egrep primer-`

# tabular output separator for column(1)
s=,

echo "📦 Comparing Primer modules published @${tag}..."
(
echo "module${s}tag${s}published${s}local"
for module in $modules; do
v_published=`npm info ${module}@${tag} .version`
v_local=`jq -Mr .version modules/${module}/package.json`
echo "${module}${s}${tag}${s}${v_published:-x}${s}${v_local}"
done
) | column -t -s=${s}