229 Commits

Author SHA1 Message Date
rami-a
615a0e4061
Snapshot Testing Proof of Concept (#5887)
* Snapshot Testing Proof of Concept (#5754)

### The problem
We currently do not have UI tests on a component level. Integrating snapshot tests would allow us to have peace of mind with each PR that it isn't going to introduce any changes to the UI unless its intended to.

### The solution
* Integrate `ios-snapshot-test-case` pod to handle generating and diffing images of components. 
* Integrate `git-lfs` to handle storage of the goldens.

This PR creates one test to showcase the ability to do snapshot tests. Upon merging this PR, you must install git-lfs in order to properly have the images pulled down. The 3 steps to do this:
1. `brew install git-lfs`
2. `git lfs install`
3. `git lfs pull`

Additionally, the golden is generated using an iOS 11 simulator at 2x scale so that the kokoro jobs are happy.

### Related bugs
Closes #5740

### Difference from #5754 
**Note:** This is a re-revert of #5754 that aims to fix issues with Travis CI by ensuring the snapshot test only runs on a single iOS version. I've opened #5888 to expand on this in the future. A few things changed in the approach in this PR:
 * We only run the snapshot test for iOS 11.2.0 until we can have an elegant solution for supporting multiple OS''s (see #5888)
 * The snapshot tests now live in their own test target to avoid issues with having to require an App host for all tests.
* Additionally, a dummy swift file was required for compilation of this new test target (see https://forums.developer.apple.com/thread/88451 for context)
2018-12-05 09:49:41 -05:00
Robert Moore
13781e6d45
[Catalog] Revert "Snapshot Testing Proof of Concept" (#5883)
Reverts material-components/material-components-ios#5754

Travis CI on `develop` branch testing has failed since snapshot testing was introduced. Rolling it back.

https://travis-ci.org/material-components/material-components-ios/builds
2018-11-30 09:20:03 -05:00
rami-a
c6a300ff2c
Snapshot Testing Proof of Concept (#5754)
### The problem
We currently do not have UI tests on a component level. Integrating snapshot tests would allow us to have peace of mind with each PR that it isn't going to introduce any changes to the UI unless its intended to.

### The solution
* Integrate `ios-snapshot-test-case` pod to handle generating and diffing images of components. 
* Integrate `git-lfs` to handle storage of the goldens.

This PR creates one test to showcase the ability to do snapshot tests. Upon merging this PR, you must install git-lfs in order to properly have the images pulled down. The 3 steps to do this:
1. `brew install git-lfs`
2. `git lfs install`
3. `git lfs pull`

Additionally, the golden is generated using an iOS 11 simulator at 2x scale so that the kokoro jobs are happy.

### Related bugs
Closes #5740
2018-11-29 15:56:06 -05:00
featherless
1fa662346f
[scripts/release] Ignore more project-wide files when generating release notes. (#5852)
### Context

When determining whether a change affects multiple components we want to ignore changes to CocoaPods files that live outside of the components directories.

### The problem + fix

Prior to this change, if a commit modified MaterialComponentsAlpha.podspec or catalog/Podfile it was being picked up as a multi-component change in the release notes.

After this change, commits affecting those files will not be treated as multi-component changes unless they also touch other files in the repo.

### Opportunities for further improvement

It's likely fair to say that any modification to files outside of the `components/` directory can be ignored. I'm not sure what the best way to filter these types of changes is, but that would be a welcome follow-up simplification of this change that would require less on-going maintenance.
2018-11-28 13:08:12 -05:00
featherless
5fa9120510
[scripts/release] Improve the notes command output. (#5796)
The script now outputs four groups of changelogs:

1. Breaking changes for specific components.
2. Breaking changes across multiple components.
3. Changes for specific components.
4. Changes acrosss multiple components.
2018-11-20 09:16:00 -05:00
featherless
d7e126772d
[kokoro] Extract more of the clang-format logic out to clang-format-ci. (#5722)
This will make it easier for us to keep all google-owned repositories running the same clang-format version in tandem.

Also moved from a submodule to a clone + version checkout so that our CI gracefully upgrades as we release new non-breaking release to clang-format-ci.

Relies on upstream changes in https://github.com/material-foundation/clang-format-ci/pull/4
2018-11-19 22:09:50 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
featherless
d26fce134b
[kokoro] Migrate github-comment and clang-format-ci to the material-foundation repos. (#5707)
## Context

Two libraries have graduated from the material-components-ios repo so that they can be used more generally across other open source projects: [clang-format-ci](https://github.com/material-foundation/clang-format-ci) and [github-comment](https://github.com/material-foundation/github-comment).

## What's going on here

Both of these libraries have been added as external submodule dependencies and the scripts have been updated to refer to the new external dependency paths.
2018-11-09 07:15:46 -05:00
featherless
531b372815
[CI] Fix the test_all script. (#5538)
## Prior to this change

Our test_all script was using an Xcode schemes search and filter to identify any test schemes that exist in the repository and test them. Unfortunately, the script was not also testing to confirm that it found at least *some* tests, meaning if it did not find any tests it would silently succeed.

The script was essentially optimized for us adding multiple test schemes in the future. In practice, the frequency with which we add new test schemes is low (we've added only one in the past year via MaterialComponentsAlpha).

## The root cause

With d238c86d47eb072617d285106147ace613321aee, our Xcode test scheme names changed and our scheme search was no longer returning our unit test schemes, resulting in test_all succeeding even though it hadn't run any tests.

## After this change

The test_all script will explicitly test specific schemes. If these schemes change or move in the future, this script will fail until we also update the script's schemes.

This script now also pipes the test output through xcpretty if it is available.

Closes https://github.com/material-components/material-components-ios/issues/5539
2018-10-26 15:29:01 -04:00
Yarden Eitan
71711cb2df
added shape theming to the scripting generation (#5463)
This add the shape theming doc generation for our components. Same as we did for color, we are adding the shape theming template so then it can be easily generated for our docs. I will generate the shape theming docs for our components in a follow up PR.
2018-10-19 16:32:33 -04:00
Ian Gordon
8185409c69 Bumped version number to 66.0.0. 2018-10-04 13:43:15 -04:00
featherless
45bbf03603
[scripts/release] Fix component extension output in apidiff command. (#5210)
Prior to this change, `Component+Extension` additions would be incorrectly listed as a "New component" in the API diff.

After this change, `Componet+Extension` additions will be listed as "New extension" in the API diff.
2018-09-24 17:37:39 +03:00
Jeff Verkoeyen
dc3b59873b Update changelog and apidiff tool. 2018-09-12 09:15:40 -04:00
Michelle Dudley
741d375605 [Codelabs] Add documentation for build_codelabs script (#4952)
* Fix typos

* Add build_codelabs documentation

* Add build_codelabs to release
2018-09-11 07:49:43 -07:00
featherless
6915a77f79 [scripts/release] Don't include automated changes in the release notes. (#4999)
Any commit with `[automated]` in its title will be excluded from the release notes.

Closes https://github.com/material-components/material-components-ios/issues/5002
2018-09-05 10:11:12 -04:00
featherless
fcf74f00c5 [scripts/release] Sort the notes output by component. (#5001)
Closes https://github.com/material-components/material-components-ios/issues/5000
2018-09-05 10:10:50 -04:00
featherless
158c9789ce [scripts/release] Remove the #### Changes header from notes output. (#5004)
Closes https://github.com/material-components/material-components-ios/issues/5003
2018-09-05 10:10:35 -04:00
featherless
00f484183c
Update material-motion-apidiff to latest origin/develop. (#4991)
This fixes an upstream bug where entire classes would be printed as part of the API diff. Most recently seen here: https://github.com/material-components/material-components-ios/pull/4988

Upstream change: https://github.com/material-motion/apidiff/pull/23
2018-09-04 15:58:09 -04:00
featherless
41b6011085 [github-comment] When posting diff comments, use only the file to unique the comment. (#4989)
This ensures that if a piece of feedback moves around within a given file (e.g. because lines were added or removed above this feedback) that we won't erroneously post the same comment again.
2018-08-31 16:19:03 -04:00
featherless
bf889f825b
[kokoro] Add a clang-format job. (#4977)
This job is our first official linter.

<img width="830" alt="screen shot 2018-08-30 at 5 12 35 pm" src="https://user-images.githubusercontent.com/45670/44880230-d8049780-ac79-11e8-926b-836b16c86f9f.png">

See https://github.com/material-components/material-components-ios/pull/4954 for an example thread in which I purposefully made some style regressions and let the tool post back to the PR until I resolved them.

This new job will apply clang-format *only* to the lines that have been changed by a given pull request. If any changes are suggested, the diff will be shown in the job's build logs and individual changes will be posted back to the PR at each suggested line.

The provided feedback can be addressed in multiple ways:

1. Manually, by copying the suggested changes into your code.
2. By running git-clang-format on your local branch. The tool will suggest this, including an ideal command line invocation to do so.

This job can be run locally, though it requires a fair amount of configuration to do so. See the job's documentation for more details on which environment variables are required.

---

This change also required modifications to the github-comment command line tool. Notably:

1. A very light-weight diff parser was added. This API takes a git diff [unified diff](https://www.gnu.org/software/diffutils/manual/html_node/Example-Unified.html#Example-Unified) file and parses it into individual [hunks](https://www.gnu.org/software/diffutils/manual/html_node/Hunks.html).
2. A hunk-correlator was added. This is the magic that translates clang-format's suggested diff into individual positions on a GitHub pull request.
3. A new GitHub API method for fetching a single file was added. We require this in order to fetch the pull request diff.
4. A new set of command line parameters was added to the github-comment tool. Use of these new parameters turn a suggested diff into a series of GitHub pull request line comments.

Before posting any new comments to the PR, the command enumerates all of the existing comments into a Set. If desired comment already exists in the set of comments then it will not be posted again. This is the mechanism by which we minimize noise generated from the job on subsequent updates to the PR.

---

The essential workflow for this tool is (on kokoro):

1. Install the clang-format version we're using internally by fetching it from our pre-built binary repository: https://github.com/material-foundation/clang-format
2. Install the git-clang-format tool.
3. Verify the checksums of both tools.
4. Run git-clang-format on the pull request.
5. If there have been no changes, exit with status 0 and post success back to the PR. Deletes any comment that had been made previously about style (this matches the apidiff behavior).
6. Otherwise, output the diff results and feed the diff to github-comment.
7. github-comment parses the pull request diff and the suggested diff, correlates the suggested hunks with the pull request hunks, and then posts individual line comments with the suggested changes.
8. If a summary comment hasn't already been posted to the PR, a summary comment is posted. Otherwise, we update the existing comment.
9. Post a failure status to the PR.
2018-08-31 14:12:14 -04:00
featherless
d9c3e3167b
[scripts/github-comment] Remove duplicate target. (#4975)
This resolves a warning that was appearing when building/running the github-comment project:

```
warning: Ignoring duplicate product 'github-comment'
```

Tested by running:

```
cd scripts/github-comment/
swift run github-comment
```

And verifying that the above warning did not appear and that the command successfully built and executed.
2018-08-31 09:32:22 -04:00
featherless
bac4dce1c7
[scripts/release] Add a dragon to publishing the podspec. (#4971) 2018-08-30 15:59:13 -04:00
featherless
a826d72398
[scripts/release] Allow umbrellas and files to generate info from a given sha. (#4961)
The umbrellas command is fed in to the apidiff tool as a filter for which components to look at.

Prior to this change, the umbrellas command was ignoring the apidiff base sha and always generating results from origin/stable.

After this change, the umbrellas and files commands will both accept an optional base sha from which to generate results.

Tested by running:

```bash
./scripts/release umbrellas HEAD
# Should output nothing
```
2018-08-30 13:57:05 -04:00
featherless
a32cb6d72b
[scripts/release] Remove email step from the release tool. (#4941)
This is no longer part of our release process.
2018-08-29 11:29:38 -04:00
featherless
42d0c8db3d
[scripts/release] Add explanations for each section of the release notes. (#4822)
The release engineer is expected to fill these sections in by gathering the information from the commits. If information is not available in a given commit, then the release engineer is expected to reach out to the commit author and ask them to provide the additional information (and encouraging them to do so in their commits in the future).
2018-08-29 09:26:15 -04:00
featherless
31e5ad0bad
[scripts/generate_readme] Add .jazzy.yaml check. (#4938) 2018-08-29 09:25:35 -04:00
Michelle Dudley
7bb145ba0f [Codelabs] Update build tests for codelabs (#4871)
Build from different branches/tags/commits.
Defaults to only build 104 and 111 complete
2018-08-22 17:34:15 -04:00
featherless
9378727562
[scripts/generate_readme] Check for a .vars file before continuing. (#4829) 2018-08-20 15:14:47 -04:00
featherless
7e31e36e41
[scripts] Add git-clang-format to the clang-format installer. (#4831)
Once installed, clang-format can be run on only the lines that have been changed by a given range of commits like so:

    # Format changes from develop to HEAD
    git clang-format develop

Running this command will change files locally. You must then commit the changes and push them to your PR.
2018-08-20 10:15:48 -04:00
Jeff Verkoeyen
b04c596e98 [scripts/generate_readme] Fix bug where \ would be dropped from generated readmes. 2018-08-10 09:55:53 -04:00
featherless
4f181203ad
[AppBar] Complete pass at documentation modernization. (#4708)
This is a complete overhaul of the App Bar documentation, fully reflecting the most modern set of APIs that we encourage and expect clients to adopt.

As part of this work, I've also written up the documentation for the various behavioral flags.

Preview the App Bar docs: 007a738fa5/components/AppBar/README.md

Preview the Flexible Header docs: 007a738fa5/components/FlexibleHeader/README.md

Closes https://github.com/material-components/material-components-ios/issues/4653
2018-08-08 09:52:12 -04:00
featherless
c5fd516b7d
[scripts/release] apidiff now includes any folder with an umbrella header. (#4732)
This change ensures that our release notes include API diffs for sub-components such as our themers.

Closes https://github.com/material-components/material-components-ios/issues/3983

Example output:

### AppBar+ColorThemer

#### MDCAppBarColorThemer

*new* class method: `+applySurfaceVariantWithColorScheme:toAppBarViewController:` in `MDCAppBarColorThemer`

*new* class method: `+applyColorScheme:toAppBarViewController:` in `MDCAppBarColorThemer`

### AppBar

#### MDCAppBarContainerViewController

*new* property: `appBarViewController` in `MDCAppBarContainerViewController`

#### MDCAppBarNavigationControllerDelegate

*new* method: `-appBarNavigationController:willAddAppBarViewController:asChildOfViewController:` in `MDCAppBarNavigationControllerDelegate`

#### MDCAppBarViewController

*new* property: `navigationBar` in `MDCAppBarViewController`

*new* property: `headerStackView` in `MDCAppBarViewController`

*new* class: `MDCAppBarViewController`
2018-08-07 15:11:55 -04:00
Galia Kaufman
cf014946d8
[Cards] Accessibility: Fixing documentation typos (#4634)
* Fixing typos in accessibility documentation for Cards.
* Fixing a script to correctly show a message when Jazzy is not installed.
2018-07-30 13:35:34 -04:00
Michelle Dudley
8a2396922f [Codelabs] Add build tests for codelabs (#4494)
Adds build tests for all iOS codelabs.
2018-07-12 16:20:33 -04:00
featherless
1eee555258
Remove extension. (#4328)
It lives here now: https://github.com/material-foundation/github-squash-and-merge-pr-descriptions
2018-05-30 16:46:32 -04:00
featherless
34ad585cec
[scripts] Add a squash-and-merge Chrome extension. (#4313)
This extension will automatically populate the suggested squash-and-merge description with the pull request's description.

## Before

![before](https://user-images.githubusercontent.com/45670/40694806-1cd8d65a-638c-11e8-97ed-0aacc5949bd4.gif)

## After

![after](https://user-images.githubusercontent.com/45670/40694816-371ae7b0-638c-11e8-9a1b-961dee011410.gif)
2018-05-30 15:42:52 -04:00
featherless
e1e6d249a4
[Docs] Add badges to all components. (#4278)
As part of our readme generator, components can now opt in to displaying badges in their readme.

The badges are generated from https://shields.io/ and are focused on an individual component. We're currently generating the following badges:

- Open bug count.
2018-05-25 11:12:48 -04:00
featherless
56dfdbbc89
[kokoro] Add new apidiff CI command. (#4245)
This command will generate an API diff for the current pull request. In a follow-up PR it will also post the results of the API diff to the PR as a comment.

This is the first of two changes to the `apidiff` branch that will add support for API diff reporting to our PRs. The second PR will add the github comment reporting tool.

This was previously reviewed in https://github.com/material-components/material-components-ios/pull/4181.
2018-05-23 12:25:50 -04:00
featherless
dcc7561c28 [scripts/release] Add support for generating API diffs to an arbitrary sha. (#4164)
E.g. to generate an API diff from v54.0.0 to HEAD:

    ./scripts/release apidiff v54.0.0
2018-05-15 13:34:31 -04:00
Adrian Secord
17db9933ed Bumped version number to 55.0.3. 2018-05-04 18:39:00 -04:00
Jeff Verkoeyen
f059a37d50 Avoid picking up class properties in the API table for READMEs. 2018-05-04 09:16:24 -04:00
Adrian Secord
8cf0cb3e14 Update material.io/go/design-theming shortlink to material.io/go/design-color-theming. 2018-05-03 18:25:37 -04:00
featherless
5019be81da
[scripts] Add support for API list generation and improve the script's messages. (#3672)
./scripts/generate_readme will now generate the Design & API documentation section if desired.

Adding the following snippet to docs/README.md will result in the design & API links section being generated. This section is auto-generated from the jazzy API output and includes all classes, protocols, and enumerations. These links were a pain in the butt to add and maintain before, and now we don't have to 🎉.

```
<!-- design-and-api -->
```

Also updated the docs docs accordingly.

Also changed the order of operations so that articles are expanded inline and then pretty lists are generated. This will ensure that articles with pretty lists also get prettified.

---

## Example input (in ActivityIndicator)

```
<!-- design-and-api -->
```

## Example output

<ul class="icon-list">
  <li class="icon-list-item icon-list-item--spec"><a href="https://material.io/go/design-progress-indicators">Material Design guidelines: Progress & Activity</a></li>
  <li class="icon-list-item icon-list-item--link">Class: <a href="https://material.io/components/ios/catalog/progress-indicators/activity-indicators/api-docs/Classes/MDCActivityIndicator.html">MDCActivityIndicator</a></li>
  <li class="icon-list-item icon-list-item--link">Class: <a href="https://material.io/components/ios/catalog/progress-indicators/activity-indicators/api-docs/Classes/MDCActivityIndicatorTransition.html">MDCActivityIndicatorTransition</a></li>
  <li class="icon-list-item icon-list-item--link">Protocol: <a href="https://material.io/components/ios/catalog/progress-indicators/activity-indicators/api-docs/Protocols/MDCActivityIndicatorDelegate.html">MDCActivityIndicatorDelegate</a></li>
  <li class="icon-list-item icon-list-item--link">Enumeration: <a href="https://material.io/components/ios/catalog/progress-indicators/activity-indicators/api-docs/Enums/MDCActivityIndicatorMode.html">MDCActivityIndicatorMode</a></li>
</ul>
2018-05-02 22:31:59 -04:00
Jeff Verkoeyen
e2c611703a Update templates to match latest style changes. 2018-05-02 20:01:55 -04:00
Jeff Verkoeyen
31a29729c4 Extract component name from .vars when generating readme.
This fixes the generator for components that live in sub-directories.
2018-05-02 18:18:57 -04:00
featherless
91eca05769
[scripts] Ensure that asset urls are remapped when generating readmes. (#3640) 2018-05-01 23:39:10 -04:00
featherless
ed19233170
[scripts] Hide readmes from the site if the component has no path. (#3637)
This allows a component to exist in the repo but not in the website. This is helpful in the case of components that should be private but aren't.
2018-05-01 22:57:41 -04:00
featherless
b3fcaf1c8c
[scripts] Ignore #\w when extracting table of content headers. (#3611)
This ignores #pragma and #include statements.
2018-05-01 15:04:40 -04:00
featherless
18617943ab
[scripts] Implement a templatized readme generator. (#3601)
This PR adds a new script, `scripts/generate_readme`, which will generate a root README.md file for a component from the component's docs/ content.

The advantages of this script over our current process of writing readmes:

- Documentation articles can be broken out into separate files, making it easier to generate and apply templates.
- Our component readmes now have auto-generated table of contents.
- Our documentation can be written in plain markdown with minimal material.io html magic.
- Having docs in separate files doesn't result in multiple "component pages" on material.io - everything ends up in a single component document on the site. E.g. the "Color Theming" article no longer shows up as its own link on material.io.

Example usage:

```bash
./scripts/generate_readme ActivityIndicator
```

---

The script makes the following assumptions:

A component has the following directory structure:

```
components/
  Component/
    README.md <- The component's main readme.
                 This is the readme that will show up on material.io.
    docs/
      README.md       <- A skeletal readme with links to other docs files.
      some-article.md <- An article that may be linked to.
```

`components/Component/docs/README.md` is treated as a standard markdown file, with the additional interpretations:

```
* [Text](url)
Treated as an icon list for the material.io website.
If the url links to any go/design- url, the link will use the spec icon

- [Text](some-article.md)
Indicates that the linked article should be added verbatim to the main README.md

<!-- toc -->
A table of contents should be generated here.
```

The script then does the following:

1. Generates a template README from the component's .vars file.
2. Appends the component's docs/README.md to the readme.
3. Rewrites any asset and relative url paths.
4. Transforms all `* [text](link)`-formatted link lists into icon-list lists.
4b. If an icon list url points to a design site, the spec icon will be used for the list item.
5. Replaces every `- [text](link)`-formatted link list item with the contents of the file.
6. Generates a table of contents if `<!-- toc -->` is found. The table of contents will include all level 2 and 3 headers found after the toc tag.
7. Copies the output to the component's root README.md.

The implication of this script is that we can now write documentation as small files which are easier to templatize. These smaller files can be aggregated together into a single larger README.md that is consumable by the material.io website.

Example of table of contents on material.io:

<img width="460" alt="screen shot 2018-05-01 at 9 07 31 am" src="https://user-images.githubusercontent.com/45670/39473887-1fa6c85c-4d1f-11e8-8620-d6b151a315c6.png">
2018-05-01 14:24:29 -04:00
Adrian Secord
7a7293883f
Remove space after triple-backtick Markdown syntax. (#3577) 2018-04-29 09:00:53 -04:00