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

Publish sequence update #1065

Merged
merged 9 commits into from
Feb 20, 2018
Merged

Publish sequence update #1065

merged 9 commits into from
Feb 20, 2018

Conversation

joshbruce
Copy link
Member

@joshbruce joshbruce commented Feb 19, 2018

Description

  1. Decided to go with preversion instead of anything related t publish...version only update the package.json file, which needs to be committed anyway; so, thinking anything that needs to be updated and part of a commit should be able to tag along.
  2. Created RELEASE.md for instructions on building a release.

This gives us a three step process when we don't include the setup things - and makes us completely within NPM commands:

  1. npm test
  2. npm version [major|minor|patch]
  3. npm publish

Replaces #1064

Review

Submitter

  • All tests pass (CI should take care of this, once in place). One known failing test.
  • All lint checks pass (CI should take care of this, once in place). Not in place yet.
  • Tests
    • Test(s) exist to ensure functionality works (if no new tests added, list which tests cover this functionality).
    • No tests required for this PR.
  • Is release:
    • Version in package.json has been updated (see RELEASE.md).
    • The marked.min.js has been updated; or,
    • release does not change library.

Reviewer

??

@joshbruce
Copy link
Member Author

Every time I tried to run the tests and the build at the same time didn't work out so well.

screen shot 2018-02-19 at 3 20 19 pm

@UziTech
Copy link
Member

UziTech commented Feb 19, 2018

We should probably fix the tests first

@UziTech
Copy link
Member

UziTech commented Feb 19, 2018

I think adding tests to preversion would be a good idea. one less step and it prevents accidentally not checking tests


1. **Major:** There is at least one change not deemed backward compatible. While in beta, the major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
2. **Minor:** There is at least one new feature added to the release. While in beta, the minor will tend to be more analagous to a `major` release. For example, we plan to release `0.4.0` once we have fixed most, if not all, known issues related to the CommonMark and GFM specifications because the architecture changes planned during `0.4.0` will most likely introduce breaking changes.
3. **Patch:** No breaking changes. Should fix a defect found in a feature. While in beta, the patch will tend to be more analagous to a `minor` release.
Copy link
Contributor

Choose a reason for hiding this comment

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

analogous

RELEASE.md Outdated
- `$ npm test` (run tests)
- `$ npm version [major|minor|patch]` (updates `package.json` and creates `min` file)
- `$ npm publish` (publish to NPM)
- [ ] Commit changes locally -> Submit PR to `origina/master` -> Merge PR
Copy link
Contributor

Choose a reason for hiding this comment

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

origin

@@ -33,6 +33,7 @@
"scripts": {
"test": "node test",
"bench": "node test --bench",
"build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js"
"build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
"preversion": "npm run build"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's best committing the minified file too

Copy link
Member Author

Choose a reason for hiding this comment

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

This should be covered by the npm version updating the package.json. Both files need to be committed at the same time.

- [ ] Fork `markedjs/marked` -> clone the library locally -> Make sure you are on the `master` branch
- [ ] Create release branch from `master` (`release-##.##.##`)
- `$ npm test` (run tests)
- `$ npm version [major|minor|patch]` (updates `package.json` and creates `min` file)
Copy link
Contributor

Choose a reason for hiding this comment

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

possibly add info about committing too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried running the commit from package.json and it didn't seem to work out. That's actually one of the things that led me to the preversion thing. When we up the version, we have to commit the change to package.json version, which included the changed min file when I tested.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you be more specific about what you did?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried the npm run build && git commit -m 'minify' -- marked.min.js

Could have been something I messed up on my end. Having said that, if we decide to put the commit directly into the chain, might want to reconsider whether it should be part of preversion. npm version has to be run, therefore, package.json will always be updated and need to be committed.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be clear, I'm a feel a little weird having the commit be automated - could just be me though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you had a npm test set up somewhere along the command chain that failed and aborted everything.
Well I like the single commit (package.json + marked.min.js) idea.

@joshbruce
Copy link
Member Author

Agreed on fixing the tests - like I say, it keeps crapping out whenever I run them from the script though...not sure if it's because of the failing test - can't remember if I removed it or not to test that theory; assuming that's what we're talking about here. :)

Inspired mainly by: https://github.com/uswds/uswds/blob/develop/RELEASE.md

@Feder1co5oave
Copy link
Contributor

Yes it's because of the failing test. The script exits 1 if any test failed.

This branch solves that problem but I wanted to add some more tests to it before merging.

- `$ npm test` (run tests)
- `$ npm version [major|minor|patch]` (updates `package.json` and creates `min` file)
- `$ npm publish` (publish to NPM)
- [ ] Commit changes locally -> Submit PR to `origin/master` -> Merge PR
Copy link
Contributor

Choose a reason for hiding this comment

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

make clear to commit package.json and marked.min.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

See if the added lines cover it.

Copy link
Contributor

Choose a reason for hiding this comment

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

yep

@joshbruce
Copy link
Member Author

Some of the comments from @Feder1co5oave made me think we might benefit from a PR Template for the project...let me know if y'all think it is too much and I'll remove it from this PR.

@Feder1co5oave
Copy link
Contributor

I was just thinking... do we really need to open a branch and then submit a PR and then merge it to master just to do a release?

@UziTech
Copy link
Member

UziTech commented Feb 20, 2018

I like that flow. Forcing PRs gives an easy way to comment on changes and makes it easy to review changes. It makes it easier for multiple people to work on the same repo.

+1 on the PR template. We could even have multiple PR templates for different types of PRs

@joshbruce
Copy link
Member Author

@Feder1co5oave: Re the branch + PR, I find it brings a consistency to operations - all code changes go through the same process. If I could figure out a way to make it so admins couldn't push, I probably would, to be honest. I like having everyone playing by the same rules...even admins. I shouldn't be able to bypass the review process just because I'm an admin.

To your point, technically, no, we don't have to do all that to create a release. The GitHub release is a professional courtesy. Even committing the new version number to GitHub is optional, I think - could just run $ npm publish then discard changes. Again, for me, it's mainly about having the same process for all the things; also agree with @UziTech's assessment as well. :)

@UziTech: Didn't know multiple templates were a thing. Not sure they've figured out the UX on that score yet (having to update the URL seems odd); however, that could explain why they took submitting PRs out of GitHub Desktop.

@joshbruce joshbruce changed the title [WIP]: Publish sequence update Publish sequence update Feb 20, 2018
@joshbruce
Copy link
Member Author

Y'all should be able to merge, if you agree with these changes...let me know if you can't.

@Feder1co5oave
Copy link
Contributor

@joshbruce I'm specifically speaking about releasing, which does not bring code changes per se. I agree that any change to the code base should be reviewed before merging.

@Feder1co5oave
Copy link
Contributor

Actually I still can't do anything... nothing changed from before the markedjs org

@joshbruce
Copy link
Member Author

@Feder1co5oave and @UziTech: Take a look this time. Upgraded both of you to have "write" permissions. master is considered a protected branch; so, it might be a bit funky.

Also, double check the "projects" tab to see if you can play with the task boards, please.

@Feder1co5oave
Copy link
Contributor

I can edit projects and issues, but I can't merge:

image

@joshbruce
Copy link
Member Author

@Feder1co5oave: Please try again and let me know. I've never used the PRs need review before merging option, wondering if that's what it was.

@Feder1co5oave
Copy link
Contributor

Nope, still like the image above. That prevents merging non-reviewed PRs for everyone.
It seems I don't have write access.

The "authorized" link takes me here

@joshbruce
Copy link
Member Author

Thanks! Let's try again. Removed protected status for master - may not have a lot of options. I always see the button because I'm an owner, I think (because I did set the selection to require admins live by the same rules as everyone else and could still merge, if I wanted to).

@joshbruce
Copy link
Member Author

Also, here is the cheat sheet I'm working from: https://help.github.com/articles/repository-permission-levels-for-an-organization/

@Feder1co5oave
Copy link
Contributor

Alright, I see the Big Green Button!

@joshbruce
Copy link
Member Author

@Feder1co5oave: Right on! Having write access seems to have been the ticket. Thinking we should all stick to using forks for now, unless there's a reason to use the mainline itself that I'm missing.

I'm going to try to protect master again. Will try to take it one step at a time.

@Feder1co5oave
Copy link
Contributor

Understood!

@joshbruce
Copy link
Member Author

In theory:

  1. @UziTech, @Feder1co5oave, and @styfle should be able to merge this PR (big green button): Can you see the merge PR button?
  2. All of our status checks should have to pass...when we turn on Travis, this will include lint and tests.
  3. Only org or repo admins will be able to push directly to Master; thereby, bypassing PR and CI processes, I think - that's why working from forks should probably be a thing. :)
  4. In theory, even admins of the org and repos should have to abide by the same rules; so, we can't circumvent things.
  5. We are not requiring PR reviews at this time prior to merging. Do we want to? (This can add a lot to the mix and may be overkill given where we are at present with the revival.)

screen shot 2018-02-20 at 10 50 35 am

@Feder1co5oave
Copy link
Contributor

  1. @UziTech, @Feder1co5oave, and @styfle should be able to merge this PR (big green button): Can you see the merge PR button?

Nope.

@UziTech
Copy link
Member

UziTech commented Feb 20, 2018

It is grayed out for me

@styfle
Copy link
Member

styfle commented Feb 20, 2018

I see grayed out button

This pull request can be automatically merged by project collaborators
Only those with write access to this repository can merge pull requests.

@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Feb 20, 2018

From the git point of view merging a PR is equivalent to pushing to the branch, so you must enable it for us. I'm not sure about requiring status checks to pass. When we'll enable CI, the status will be clearly visibile right above the merge button so the reviewer can easily check its log but I personally wouldn't put a hard rule on it since it's not very well tested yet.

@Feder1co5oave
Copy link
Contributor

On the other hand, requiring at least a positive review looks like a good compromise to me

@joshbruce
Copy link
Member Author

@Feder1co5oave: I hear ya. I think from the GitHub user-perspective (permissions), you need to have write access as collaborators to be able to merge (before it was read). So, only collaborators with write access can merge.

Turned off status checks for now...let me know what you get. (Sorry, too accustomed to working alone in organizations - odd as that may sound.)

@Feder1co5oave
Copy link
Contributor

Still a grey button here... and here is what I see on a CI-checked PR:

image

@UziTech
Copy link
Member

UziTech commented Feb 20, 2018

Somewhat unrelated question... should we be added to the markedjs org? Being part of the organization would give us a private discussion area so we wouldn't need to open prs or issues to discuss stuff.

@joshbruce
Copy link
Member Author

@UziTech: Invites sent.

Can I also get a green button check? Only options I have set right now are to protect master and apply rules to admins - but there are no other checks marked.

@styfle
Copy link
Member

styfle commented Feb 20, 2018

LGTM 👍

image

@joshbruce
Copy link
Member Author

All right. Going to merge this one.

Then I'm going to see what happens when I do the sequence to confirm things.

@joshbruce joshbruce merged commit e47a584 into markedjs:master Feb 20, 2018
@joshbruce joshbruce deleted the publish-sequence-update branch February 20, 2018 20:43
@joshbruce joshbruce mentioned this pull request Feb 20, 2018
11 tasks
@Feder1co5oave
Copy link
Contributor

Sorry I've been a little absent and did a sloppy review, but I feel I have a couple of problems with this proposal.

The pull request template is a little confusing. First of all, all the checklist items regarding the release should not be there, but possibly in the RELEASE.md. They're confusing since they really have nothing to do with a PR that aims to solve some issue.
Plus I've already voiced my opinion that releases don't really need a PR, but I see that having the need for a review can help in making sure everything is okay before releasing. So it is important to submit the release PR, wait for a review, merge the PR, and only then publish on npm and create the release on github. (maybe make this clear in RELEASE.md?)

About the release PR, the things that needs to be checked are:

  • tests (covered by CI in the PR status)
  • linting (covered by CI in the PR status)
  • new version in package.json
  • marked.min.js is updated. I don't see the point of releasing without a code change unless it is the case only the package.json file need an update (like in Update package.json to new GitHub repo #1054 but that is rare).

So all in all, three things need to be checked regarding the release PR by the reviewer:

  • CI status is green
  • package.json has the new version in it
  • marked.min.js is updated.

Whereas, in case of a contribution PR to solve some issue, I would treat it as if it were an "issue + patch" combination. So it either references some already submitted issue, or it presents the issue itself in the correct manner (expected/actual input/output samples):

  • specify which version of marked is affected (either by npm version or commit hash you're using)

  • if you're behind the current master, check that out and see if the issue has already been fixed (if you can)

  • if relevant, post clear input, expected output, and actual output:

    ## input
    <expected output>
    <actual output>
  • if possible, type the input in babelmark and inspect the output by the different converters (notice that they're using an outdated marked version so don't take its output into consideration)

  • if an error is thrown, post the complete call stack and the markdown input

Then, for the code change, I would prepare the following checklist:

  • new tests added (if not necessary, list which tests cover this functionality)
  • old tests pass (run npm test)
  • code style is good (run npm run lint and correct any error messages before committing)
  • if feature proposal, document it clearly in the README

I would leave listing the other fixed issues to us collaborators since that is quite tricky.

So I guess these are my draft proposals for the issue and pull request templates, let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants