From 017e1c5d86fa3d5a8c74dc599e2ef42e9cb6505b Mon Sep 17 00:00:00 2001 From: "Kenneth G. Franqueiro" Date: Wed, 27 Mar 2019 15:51:02 -0400 Subject: [PATCH 1/3] docs: Update release process for major/minor releases (#4532) --- docs/open_source/release-process.md | 192 +++++++++++++++++++--------- 1 file changed, 132 insertions(+), 60 deletions(-) diff --git a/docs/open_source/release-process.md b/docs/open_source/release-process.md index 50e4fcaf7ea..e8cfd1069c8 100644 --- a/docs/open_source/release-process.md +++ b/docs/open_source/release-process.md @@ -1,11 +1,24 @@ # Release Process -## Vocabulary +**TIP:** Run the following script in the dev console to automatically expand the appropriate sections in this page for +the type of release you're interested in performing. +(You can replace `'minor'` on the last line with `'major'` or `'patch'`.) + +```js +(function(type) { + document.querySelectorAll('details').forEach((el) => { + const summary = el.querySelector('summary'); + el.open = summary && summary.textContent.toLowerCase().includes(`${type} release`); + }) +})('minor'); +``` + +### Vocabulary This document reuses the [terminology for release types](./releases-and-branches.md#release-types) summarized in the Releases and Branches documentation. -## First-time Setup +## 0. First-time Setup > Employees are supposed to do this as part of onboarding, but we've put it here > as a reminder. @@ -14,12 +27,12 @@ Releases and Branches documentation. This will log you into NPM. -## Announce +## 1. Announce -Ping the Slack announcements channel first! This will let other members of the +Ping the announcements channel first! This will let other members of the team know NOT to merge PRs during this release process. -## Check Out Code +## 2. Check Out Code Check out the master branch and update: @@ -29,25 +42,51 @@ git checkout master && git pull && git fetch --tags This will pull the latest tags and `master` commits into your local repository. -### Additional Step for Patch Releases +
+ Additional Step for Minor Releases and Patch Releases + +
+ For Minor Releases + +First, checkout the latest previous patch version (e.g. `vX.0.1`). -Run the following script to automatically cherry-pick new bugfixes on top of the last release: +Then run the following script to automatically cherry-pick only the appropriate commits on top of the last release. + +``` +node scripts/cherry-pick-commits --minor +``` + +
+ +
+ For Patch Releases + +First, make sure you checkout the correct branch or tag based on what you're releasing: + +* If you're releasing the first non-major version ever after a major version (typically X.0.1), checkout `master`. +* If you're releasing the first patch after a minor version (e.g. X.1.1), checkout the minor version (e.g. `vX.1.0`). +* If you're releasing a subsequent patch (e.g. X.Y.2), checkout `vX.Y.1`. + +Once you're on the correct base, run the following script to automatically cherry-pick only the appropriate commits on +top of the last release. ``` node scripts/cherry-pick-commits --patch ``` -> Note: After running the script, you are in a detached HEAD state. You can create a temporary local branch if desired, -> but all that needs to be pushed is the tag produced at the end of the release process. +
-Read the output carefully: +Read the output of the cherry-pick script carefully: * You may need to cherry-pick commits that the script could not cherry-pick cleanly without conflict -* The script may have cherry-picked fixes that rely on breaking changes or new features; these need to be removed. +* The script may have cherry-picked commits that rely on skipped commits; these need to be removed. This is especially likely if the script reports that either the build or the unit tests failed. * Examine `git log` to ensure there are no unexpected commits beyond the previous tag (in case any breaking changes weren't flagged properly, or features were mislabeled as fixes, etc.) +> NOTE: After running the script, you are in a detached HEAD state. You can create a temporary local branch if desired, +> but all that needs to be pushed is the tag produced at the end of the release process. + If you find you need to remove commits that should not have been cherry-picked, perform the following steps: 1. Find the base tag that the cherry-pick script identified and used (find the "Checking out vX.Y.Z" line in the output) @@ -56,10 +95,9 @@ If you find you need to remove commits that should not have been cherry-picked, 1. Save and exit (`:x` in vim) 1. Re-check `git log` to confirm that the commits are no longer present -> Note: In the rare event that zero commits were skipped, you can simply checkout master and cut the release as you -> would normally do for a minor release, and skip all of the cherry-picking back and forth. +
-## Preparation +## 3. Preparation Run the pre-release script: @@ -68,7 +106,7 @@ Run the pre-release script: This will ensure you can publish/tag, build all release files, and ensure all tests pass prior to releasing (lerna will update versions for us in the next step). -## Disable 2FA +### Disable 2FA If you have two-factor authentication enabled on your NPM account (you should), you'll need to temporarily disable it: @@ -78,35 +116,24 @@ npm profile disable-2fa See Lerna issues [#1137](https://github.com/lerna/lerna/issues/1137) and [#1091](https://github.com/lerna/lerna/issues/1091) for more information. -## Publish to npm +## 4. Publish to npm -### For Minor Releases +> TIP: You can use `npx lerna updated [--since=...]` to preview which packages it would publish before running the +> commands in this section. ``` -$(npm bin)/lerna publish --skip-git --since= +npx lerna publish --skip-git --since= ``` -When lerna prompts for version, choose Minor. +When lerna prompts for version, choose Major, Minor, or Patch as appropriate. Be sure to include the command-line flags: * `--skip-git` avoids immediately applying a git tag, which we will do later after updating the changelog -* `--since=` (e.g. `--since=v0.36.1`) forces lerna to diff against the latest patch; otherwise, - it diffs against the previous minor release which may cause some packages without changes to be published (this - happens when bugfix releases aren't tagged from the master branch) - -### For Patch Releases - -``` -$(npm bin)/lerna publish --skip-git -``` +* `--since=` (e.g. `--since=v1.0.1`) forces lerna to diff against the latest tag; otherwise, + it may cause some packages without changes to be published if it diffs against the wrong release based on git history -When lerna prompts for version, choose Patch. - -Be sure to include the command-line flag; `--skip-git` avoids immediately applying a git tag, which we will do later -after updating the changelog. - -## Enable 2FA +### Enable 2FA If you temporarily disabled two-factor authentication on your NPM account, you'll need to re-enable it: @@ -116,17 +143,16 @@ npm profile enable-2fa auth-and-writes See Lerna issues [#1137](https://github.com/lerna/lerna/issues/1137) and [#1091](https://github.com/lerna/lerna/issues/1091) for more information. -## Commit Version Bumps +## 5. Commit Version Bumps -Regardless of which arguments were passed to `lerna publish` above, at this point the packages will have been -published to npm, but you will have local changes to update the versions of each package that was published, -which need to be committed: +At this point the packages will have been published to npm, but you will have local changes to update the versions of +each package that was published, which need to be committed: ``` git commit -am "chore: Publish" ``` -## Update Changelog and Create Git Tag +## 6. Update Changelog and Create Git Tag It's recommended to generate the changelog prior to running the post-release script so you can double-check the changes before it creates a tag: @@ -138,8 +164,12 @@ git diff # Review the changelog and make sure it looks OK In certain cases, there are some typical edits to make the changelog easier to read: -* **For a minor release after an off-master patch release:** - Remove any duplicated items in the new minor release that were already listed under patch releases. +
+ For a major release after a minor/patch, or a minor release after a patch + +* Remove any duplicated items in the new release that were already listed under previous releases + +
Once you're sure about the changes, run the `post-release` script to commit and create an annotated git tag: @@ -147,9 +177,7 @@ Once you're sure about the changes, run the `post-release` script to commit and ./scripts/post-release.sh ``` -## Push - -### Common First Step for All Releases +## 7. Push You will need to temporarily alter Github's master branch protection in order to push after the release: @@ -160,7 +188,8 @@ You will need to temporarily alter Github's master branch protection in order to 1. Perform the process outlined in one of the sections below 1. Don't forget to re-enable "Include administrators" & click "Save changes" afterwards -### For Minor Releases +
+ For Major Releases ``` git push origin master @@ -169,14 +198,17 @@ git push origin master This will ensure the new commits *and* tag are pushed to the remote git repository. (e.g. `git push origin master v0.39.0`) -### For Patch Releases +
+ +
+ For Minor Releases or Patch Releases ``` git push origin ``` -We don't need to push a branch for bugfix releases since we only cherry-pick commits for them at release time and they -are not tagged from master (which contains all commits, not just bugfixes). +We don't need to push a branch for these releases since we only cherry-pick commits for them at release time and they +are not tagged from master (which contains all commits, including breaking changes). However, we *do* need to sync the new release versions and changelog with master. Run `git log` and take note of the publish and changelog commit hashes. Then switch to master and cherry-pick them: @@ -187,26 +219,53 @@ git cherry-pick -x git push ``` -## Update and Deploy Catalog Repository +> NOTE: The `-x` argument above adds the original cherry-picked commit's hash in the commit description. +> This is referenced by the cherry-pick script to tie minor/patch releases to their cherry-picked commits on master. -### For Patch Releases +
+ Additional Note for Minor Releases -1. Update the `material-components-web` dependency in the catalog's `package.json` to the new patch version -1. Run `npm start` and glance through the catalog pages to make sure everything looks normal -1. Send a PR for the dependency update, then run `npm run deploy` once it's merged to master +Minor releases are likely to experience conflicts when cherry-picking the `chore: Publish` commit back into master. +This is because master already had the patch version bumps cherry-picked in, and then can't resolve the diffs generated +by the minor branch which go directly from the previous minor version to the new one. + +You may wish to abort the cherry-pick and then retry with the recursive/theirs strategy: + +``` +git cherry-pick --abort +git cherry-pick -x --strategy=recursive -X theirs +``` + +You should examine the generated changeset (with `git show`) to ensure that it didn't unintentionally steamroll any +newer version numbers (which could happen if a package previously had a patch release but did not receive a minor bump). + +Once you're sure it's OK, continue with the changelog commit and push: + +``` +git cherry-pick -x +git push +``` + +
+ +
-### For Minor Releases +## 8. Update and Deploy Catalog Repository + +
+ For Major Releases or Minor Releases We typically maintain a `next` branch on the MDC Web Catalog repository which works ahead of MDC Web releases (using [this script](https://gist.github.com/kfranqueiro/d06c7073c5012de3edb6c5875d6a4a50)), to keep ahead of breaking changes. -In the event no work was done on the `next` branch, the above process for patch releases would be followed, but would require -checking for necessary updates to accommodate breaking changes in MDC Web. +In the event no work was done on the `next` branch, the process below for patch releases would be followed, but would require +checking for necessary updates to accommodate new features or breaking changes in MDC Web. -Below is the process when a `next` branch is used: +
+ Process for when a next branch is used 1. Ensure you have the latest `master` checked out: `git checkout master && git pull` -1. Create a new branch, e.g.: `git checkout -b chore/0.36.0` +1. Create a new branch, e.g.: `git checkout -b chore/1.0.0` 1. Merge `next` into the branch: `git merge next` 1. Deal with any conflicts if necessary 1. Update `package.json` to reference the newly-released minor version of `material-components-web` @@ -229,13 +288,26 @@ Below is the process when a `next` branch is used: 1. `git push -f origin next` 1. Re-protect the `next` branch by changing the `master` rule match back to `[mn][ae][sx]t*` -## Log Issues in MDC React Repository +
+ +
+ +
+ For Patch Releases + +1. Update the `material-components-web` dependency in the catalog's `package.json` to the new patch version +1. Run `npm start` and glance through the catalog pages to make sure everything looks normal +1. Send a PR for the dependency update, then run `npm run deploy` once it's merged to master + +
+ +## 9. Log Issues in MDC React Repository MDC React does not currently maintain a branch that gets updated ahead of release. After release, ensure that any breaking changes likely to require MDC React changes have issues logged on the MDC React repository, with the "required for sync" label. -## Notify material.io Team +## 10. Notify material.io Team Our markdown documentation is transformed and mirrored to the Develop section of material.io. From e6bd95cdfc049a68cec3e5e3882dcc6ee0487a18 Mon Sep 17 00:00:00 2001 From: Abhinay Omkar Date: Thu, 28 Mar 2019 14:33:30 +0000 Subject: [PATCH 2/3] chore: Update golden screenshots after brower upgrade (#4549) --- test/screenshot/golden.json | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/screenshot/golden.json b/test/screenshot/golden.json index 3e0c9c90e51..80728507ec1 100644 --- a/test/screenshot/golden.json +++ b/test/screenshot/golden.json @@ -384,9 +384,9 @@ } }, "spec/mdc-dialog/classes/baseline-confirmation.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/baseline-confirmation.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/baseline-confirmation.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/baseline-confirmation.html.windows_chrome_69.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/baseline-confirmation.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/baseline-confirmation.html.windows_firefox_62.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/baseline-confirmation.html.windows_ie_11.png" } @@ -408,25 +408,25 @@ } }, "spec/mdc-dialog/classes/overflow-accessible-font-size.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-accessible-font-size.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-accessible-font-size.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-accessible-font-size.html.windows_chrome_72.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-accessible-font-size.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/21_55_33_374/spec/mdc-dialog/classes/overflow-accessible-font-size.html.windows_firefox_65.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/overflow-accessible-font-size.html.windows_ie_11.png" } }, "spec/mdc-dialog/classes/overflow-bottom.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-bottom.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-bottom.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-bottom.html.windows_chrome_72.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-bottom.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/21_55_33_374/spec/mdc-dialog/classes/overflow-bottom.html.windows_firefox_65.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/overflow-bottom.html.windows_ie_11.png" } }, "spec/mdc-dialog/classes/overflow-top.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-top.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-top.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/classes/overflow-top.html.windows_chrome_72.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/classes/overflow-top.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/21_55_33_374/spec/mdc-dialog/classes/overflow-top.html.windows_firefox_65.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/classes/overflow-top.html.windows_ie_11.png" } @@ -456,17 +456,17 @@ } }, "spec/mdc-dialog/mixins/max-height.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/mixins/max-height.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/mixins/max-height.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/mixins/max-height.html.windows_chrome_72.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/mixins/max-height.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/20/22_18_39_902/spec/mdc-dialog/mixins/max-height.html.windows_firefox_63.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/mixins/max-height.html.windows_ie_11.png" } }, "spec/mdc-dialog/mixins/max-width.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/mixins/max-width.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/mixins/max-width.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/22_13_08_557/spec/mdc-dialog/mixins/max-width.html.windows_chrome_72.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-dialog/mixins/max-width.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/21_55_33_374/spec/mdc-dialog/mixins/max-width.html.windows_firefox_65.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/21/16_50_45_748/spec/mdc-dialog/mixins/max-width.html.windows_ie_11.png" } @@ -568,17 +568,17 @@ } }, "spec/mdc-elevation/classes/baseline-large.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-large.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-elevation/classes/baseline-large.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-large.html.windows_chrome_69.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-elevation/classes/baseline-large.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-large.html.windows_firefox_62.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-large.html.windows_ie_11.png" } }, "spec/mdc-elevation/classes/baseline-small.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-small.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-elevation/classes/baseline-small.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-small.html.windows_chrome_69.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-elevation/classes/baseline-small.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-small.html.windows_firefox_62.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/09/26/06_08_27_877/spec/mdc-elevation/classes/baseline-small.html.windows_ie_11.png" } @@ -1640,9 +1640,9 @@ } }, "spec/mdc-textfield/issues/4170.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/01/31/18_07_04_819/spec/mdc-textfield/issues/4170.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-textfield/issues/4170.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/01/31/18_07_04_819/spec/mdc-textfield/issues/4170.html.windows_chrome_71.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-textfield/issues/4170.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/01/31/18_07_04_819/spec/mdc-textfield/issues/4170.html.windows_firefox_64.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/01/31/18_07_04_819/spec/mdc-textfield/issues/4170.html.windows_ie_11.png" } @@ -1672,9 +1672,9 @@ } }, "spec/mdc-typography/mixins/mixins.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/09/10/17_42_51_602/spec/mdc-typography/mixins/mixins.html?utm_source=golden_json", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-typography/mixins/mixins.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/08/08_47_39_000/spec/mdc-typography/mixins/mixins.html.windows_chrome_68.png", + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/27/14_53_21_982/spec/mdc-typography/mixins/mixins.html.windows_chrome_73.png", "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/09/10/17_42_51_602/spec/mdc-typography/mixins/mixins.html.windows_firefox_62.png", "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/08/08_47_39_000/spec/mdc-typography/mixins/mixins.html.windows_ie_11.png" } From 4bf7a86ab48ee01136069d326a4d6ded7a7f883e Mon Sep 17 00:00:00 2001 From: Abhinay Omkar Date: Thu, 28 Mar 2019 13:12:18 -0400 Subject: [PATCH 3/3] fix(shape): Allow percentage based global overrides (#4548) --- packages/mdc-shape/_functions.scss | 8 +- test/screenshot/golden.json | 8 + test/screenshot/spec/mdc-shape/fixture.js | 26 ++++ test/screenshot/spec/mdc-shape/fixture.scss | 40 +++++ .../spec/mdc-shape/variables/override.html | 139 ++++++++++++++++++ 5 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 test/screenshot/spec/mdc-shape/fixture.js create mode 100644 test/screenshot/spec/mdc-shape/fixture.scss create mode 100644 test/screenshot/spec/mdc-shape/variables/override.html diff --git a/packages/mdc-shape/_functions.scss b/packages/mdc-shape/_functions.scss index 183496e4978..9855dd312e0 100644 --- a/packages/mdc-shape/_functions.scss +++ b/packages/mdc-shape/_functions.scss @@ -71,13 +71,15 @@ } @function mdc-shape-resolve-percentage-for-corner_($component-height, $radius) { - @if type-of($radius) == "number" and unit($radius) == "%" { + $radius-value: mdc-shape-prop-corner-value_($radius); + + @if type-of($radius-value) == "number" and unit($radius-value) == "%" { // Converts the percentage to number without unit. Example: 50% => 50. - $percentage: $radius / ($radius * 0 + 1); + $percentage: $radius-value / ($radius-value * 0 + 1); @return $component-height * ($percentage / 100); } @else { - @return $radius; + @return $radius-value; } } diff --git a/test/screenshot/golden.json b/test/screenshot/golden.json index 80728507ec1..92a662bb08a 100644 --- a/test/screenshot/golden.json +++ b/test/screenshot/golden.json @@ -1079,6 +1079,14 @@ "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-select/mixins/shape-radius.html.windows_ie_11.png" } }, + "spec/mdc-shape/variables/override.html": { + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/28/02_09_33_134/spec/mdc-shape/variables/override.html?utm_source=golden_json", + "screenshots": { + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/28/02_09_33_134/spec/mdc-shape/variables/override.html.windows_chrome_73.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/28/02_09_33_134/spec/mdc-shape/variables/override.html.windows_firefox_65.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2019/03/28/02_09_33_134/spec/mdc-shape/variables/override.html.windows_ie_11.png" + } + }, "spec/mdc-snackbar/classes/baseline-with-action.html": { "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2019/02/11/21_55_33_374/spec/mdc-snackbar/classes/baseline-with-action.html?utm_source=golden_json", "screenshots": { diff --git a/test/screenshot/spec/mdc-shape/fixture.js b/test/screenshot/spec/mdc-shape/fixture.js new file mode 100644 index 00000000000..dc3b4c17982 --- /dev/null +++ b/test/screenshot/spec/mdc-shape/fixture.js @@ -0,0 +1,26 @@ +/** + * @license + * Copyright 2019 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +window.mdc.testFixture.fontsLoaded.then(() => { + window.mdc.testFixture.notifyDomReady(); +}); diff --git a/test/screenshot/spec/mdc-shape/fixture.scss b/test/screenshot/spec/mdc-shape/fixture.scss new file mode 100644 index 00000000000..b56ea0e932a --- /dev/null +++ b/test/screenshot/spec/mdc-shape/fixture.scss @@ -0,0 +1,40 @@ +// +// Copyright 2019 Google Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +// stylelint-disable scss/dollar-variable-pattern +$mdc-shape-small-component-radius: 50%; +$mdc-shape-medium-component-radius: 50%; +$mdc-shape-large-component-radius: 50%; +// stylelint-enable scss/dollar-variable-pattern + +@import "../../../../packages/mdc-button/mdc-button"; +@import "../../../../packages/mdc-fab/mdc-fab"; +@import "../../../../packages/mdc-textfield/mdc-text-field"; +@import "../../../../packages/mdc-select/mdc-select"; +@import "../mixins"; + +.test-cell--fab, +.test-cell--button, +.test-cell--textfield, +.test-cell--select { + @include test-cell-size(301, 81); +} diff --git a/test/screenshot/spec/mdc-shape/variables/override.html b/test/screenshot/spec/mdc-shape/variables/override.html new file mode 100644 index 00000000000..217f7702c0c --- /dev/null +++ b/test/screenshot/spec/mdc-shape/variables/override.html @@ -0,0 +1,139 @@ + + + + + + Shape Global Overrides - MDC Web Screenshot Test + + + + + + + + + + +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ +
+
+ + + +
+
+
+ +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+ + + + + + + + + +