Skip to content

Commit

Permalink
chore(ci): enable CircleCI snapshot and doc publishing (angular#11608)
Browse files Browse the repository at this point in the history
<!-- 
Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed.
-->
## PR Checklist
Please check that your PR fulfills the following requirements:
- [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format)
- [x] Tests for the changes have been added or this is not a bug fix / enhancement
- [x] Docs have been added, updated, or were not required

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[x] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:
```

## What is the current behavior?
CircleCI is not enabled to create snapshots, add tags, or update the docs on commits to `master`.
<!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. -->
Issue Number: 
Relates to angular#11592

## What is the new behavior?
After a commit to master, CircleCI runs lint and tests against different AngularJS versions. If those are successful and the commit was to the `master` branch, then it snapshots, commits to `angular/code.material.angularjs.org`, and deploys the updated docs site. It also commits and tags the code snapshot in `angular/bower-material`.

## Does this PR introduce a breaking change?
```
[ ] Yes
[x] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. -->

## Other information
The list of tasks related to this and their order can be found in angular#11592.

**Caretaker note:** This can't be merged until the GitHub tokens get set up in the CircleCI environment variables as described in angular#11592.
  • Loading branch information
Splaktar authored and mmalerba committed Jan 29, 2019
1 parent 4d410ba commit cacbc46
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 20 deletions.
64 changes: 55 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ var_9: &store_junit_test_results
store_test_results:
path: ./artifacts/junit

# Branch filter that we can specify for jobs that should only run on publish branches. This filter
# is used to ensure that not all upstream branches will be published as Github builds
# (e.g. revert branches, feature branches)
var_10: &publish_branches_filter
branches:
only:
- master

# -----------------------------
# Container version of CircleCI
# -----------------------------
Expand Down Expand Up @@ -137,6 +145,25 @@ jobs:
- run: ./scripts/circleci/run-tests.sh
- *store_junit_test_results

# ------------------------------------------------------------------------------------------
# Jobs that snapshot the `master` branch and update the docs on commits to master
# ------------------------------------------------------------------------------------------
bower_material_snapshot:
<<: *job_defaults
steps:
- *checkout_code
- *restore_cache
- *npm_install
- run: ./scripts/bower-material-release.sh

update_and_snapshot_docs:
<<: *job_defaults
steps:
- *checkout_code
- *restore_cache
- *npm_install
- run: ./scripts/circleci/update-snapshot-and-docs.sh

# ----------------------------------------------------------------------------------------
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
# one job depends on another.
Expand All @@ -150,14 +177,33 @@ workflows:
- lint

# Build and test workflow. A workflow includes multiple jobs that run in parallel. All jobs
# that build and test source code should be part of this workflow
build:
# that build and test source code should be part of this workflow.
build_and_test:
jobs:
- build

unit_tests:
jobs:
- test_angularjs_1.5
- test_angularjs_1.6
- test_angularjs_1.7
- test_angularjs_snapshot
- test_angularjs_1.5:
requires:
- build
- test_angularjs_1.6:
requires:
- build
- test_angularjs_1.7:
requires:
- build
- test_angularjs_snapshot:
requires:
- build
- bower_material_snapshot:
filters: *publish_branches_filter
requires:
- test_angularjs_1.5
- test_angularjs_1.6
- test_angularjs_1.7
- test_angularjs_snapshot
- update_and_snapshot_docs:
filters: *publish_branches_filter
requires:
- test_angularjs_1.5
- test_angularjs_1.6
- test_angularjs_1.7
- test_angularjs_snapshot
2 changes: 1 addition & 1 deletion config/build.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const pkg = require('../package.json');

module.exports = {
ngVersion: '1.7.5',
ngVersion: '1.7.6',
version: pkg.version,
repository: pkg.repository.url
.replace(/^git/,'https')
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"@octokit/rest": "^15.9.2",
"add-stream": "^1.0.0",
"ajv": "^6.6.2",
"angular": "^1.7.5",
"angular-animate": "^1.7.5",
"angular-aria": "^1.7.5",
"angular-messages": "^1.7.5",
"angular-mocks": "^1.7.5",
"angular-route": "^1.7.5",
"angular-sanitize": "^1.7.5",
"angular-touch": "^1.7.5",
"angular": "^1.7.6",
"angular-animate": "^1.7.6",
"angular-aria": "^1.7.6",
"angular-messages": "^1.7.6",
"angular-mocks": "^1.7.6",
"angular-route": "^1.7.6",
"angular-sanitize": "^1.7.6",
"angular-touch": "^1.7.6",
"angularytics": "^0.4.0",
"canonical-path": "0.0.2",
"cli-color": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/bower-material-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function run {

cd bower-material

# GitHub token specified as Travis environment variable
# GitHub token with push permission specified as environment variable
git config user.name "${commitAuthorName}"
git config user.email "${commitAuthorEmail}"
git config credential.helper "store --file=.git/credentials"
Expand Down
2 changes: 1 addition & 1 deletion scripts/snapshot-docs-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function run {

cd code.material.angularjs.org

# GitHub token specified as Travis environment variable
# GitHub token with push permission specified as environment variable
git config user.name "${commitAuthorName}"
git config user.email "${commitAuthorEmail}"
git config credential.helper "store --file=.git/credentials"
Expand Down

0 comments on commit cacbc46

Please sign in to comment.