np
np copied to clipboard
Ensure CI has passed
If .travis.yml
exists, use the Travis API to verify the build for the latest commit has passed (this should come after ensuring the latest commit has been pulled down).
Same thing if appveyor.yml
exits, use the AppVeyor API.
Both API's provide the commit sha, so it should be fairly easy.
If the CI build is pending, it would be really cool if we just awaited the build result (instead of failing). That way you could merge a commit into master and execute np
immediately, knowing it will wait for CI to finish before actually publishing.
Cool idea! I've seen something similar done by having Travis publish on success, but this sounds much simpler and better. I don't think it should be default behavior, but rather an opt-in flag.
You wouldn't want to check status by default? Or do you mean just the await completion part?
The await completion part.
Would be a cool feature. Although waiting for AppVeyor to complete? Do we really want to wait 1 hour before the module is actually being published?
Do we really want to wait 1 hour before the module is actually being published?
Yep. It's a requirement for publishing AVA. That's a big part of why I want this feature. I want to hit publish and go to bed / lunch instead of hanging around that extra hour waiting on CI just so I can take the next step. (Paid Appveyor is much better BTW)
After I typed my comment I actually realized that might be a good thing actually. So yeah, let's do it :)!
I think it should await completion by default, but provide a key sequence / prompt you can use to avoid waiting (and a --skip-ci
flag).
If we don't await by default what do we do if a build is pending? Fail / Pass? Awaiting it with an option to skip or exit seems to make the most sense
Exit and show a message that it can be skipped via (something like) --skip-ci
?
Never mind, that doesn't make sense. I think we should await by default and add --skip-ci
.
If we await for the CI, shouldn't we bypass the local cleanup/installation/testing? Seems moot then.
Nah. You are doing an OSX sanity check before publishing. Also, you might be publishing days after the last CI run, and dependencies might have updated.
If you are actually awaiting CI, then chances are you've got time to run the tests locally before CI finishes
What do you think about using the GitHub API, something like https://api.github.com/repos/sindresorhus/np/statuses/master and checking that everything is successful
?
@tusbar I think that's a better solution, yes, since it will work with any service.
If anyone wants to work on this, please first make yourself familiar with the discussion in https://github.com/sindresorhus/np/pull/289 and use that as a starting point. There are several unanswered questions in that thread, so it would be best to discuss a solution here before starting to work on it.