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

Mayflower v10 rush monorepo #1195

Merged
merged 65 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e285ff7
Updates gitignore file.
smurrayatwork Sep 14, 2020
a1098d1
Adds Rush, PNPM support, WIP.
smurrayatwork Sep 14, 2020
8418648
WIP: Fixes develop, build modes, updates circleci for rush and pnpm.
smurrayatwork Sep 14, 2020
41068ad
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
7e860a1
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
2befe8c
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
c644d36
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
842833b
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
4085ceb
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
67cd4e9
WIP: Testing pnpx with rush
smurrayatwork Sep 14, 2020
6a33475
WIP
smurrayatwork Sep 15, 2020
a89706b
WIP
smurrayatwork Sep 15, 2020
66cfce4
Moves patternlab to packages, fixes eslint bugs.
smurrayatwork Sep 17, 2020
e164dda
Fixes circleci pathing for monorepo.
smurrayatwork Sep 17, 2020
b2e06e7
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
4c6dfba
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
4d370ce
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
84f0e01
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
24a5ab0
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
ac15033
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
de660e0
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
b8f8c30
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
6fc5fee
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
f171f00
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
1f67b0d
Fixes circleci patternlab.
smurrayatwork Sep 17, 2020
2f416f4
Installs node 12 with nvm.
smurrayatwork Sep 17, 2020
79299d1
Installs node 12 with nvm.
smurrayatwork Sep 17, 2020
dae229a
Updates patternlab image to use circleci provided image.
smurrayatwork Sep 18, 2020
68da7ec
Updates patternlab image to use circleci provided image.
smurrayatwork Sep 18, 2020
e89da8e
Updates patternlab image to use circleci provided image.
smurrayatwork Sep 18, 2020
71bdf42
Updates patternlab image to use circleci provided image.
smurrayatwork Sep 18, 2020
8f9bf84
Updates patternlab image to use circleci provided image.
smurrayatwork Sep 18, 2020
f2c6c90
Installing aws on patternlab_deploy_branch workflow.
smurrayatwork Sep 21, 2020
39e6eee
Installing aws on patternlab_deploy_branch workflow.
smurrayatwork Sep 21, 2020
03ff350
Installing aws on patternlab_deploy_branch workflow.
smurrayatwork Sep 21, 2020
bd0b01b
WIP.
smurrayatwork Sep 22, 2020
863a48f
Fixes merge conflict.
smurrayatwork Sep 30, 2020
c9f2641
Fixes react dependencies for pnpm.
smurrayatwork Sep 30, 2020
3b2a4f2
Lint fixes.
smurrayatwork Sep 30, 2020
3d0c3f6
Updates mayflower repo readme on using the monorepo.
smurrayatwork Oct 1, 2020
dace259
Updates mayflower repo readme on using the monorepo.
smurrayatwork Oct 1, 2020
2e5a063
Fixes gitignore rules that was breaking patternlab builds.
smurrayatwork Oct 6, 2020
2f503a8
Fixes patternlab cache in circleci.
smurrayatwork Oct 6, 2020
49b8183
Fixes patternlab to use normalize again.
smurrayatwork Oct 6, 2020
6bba2bb
add to doc
clairesunstudio Oct 8, 2020
3186ce6
update doc
clairesunstudio Oct 8, 2020
3bc4cdf
add back package.json for auto release scripts
clairesunstudio Oct 8, 2020
1520878
add commands at the root
clairesunstudio Oct 8, 2020
3f16426
fix
clairesunstudio Oct 8, 2020
faa5336
Adds support for running custom rush commands at root for starting si…
smurrayatwork Oct 8, 2020
736b342
Fixes merge conflict.
smurrayatwork Oct 8, 2020
c9e5d15
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
3986a75
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
68b74f6
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
bda7cac
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
5cb30e2
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
14aee94
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
50b4583
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
c8326ec
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
5602d71
Fixes circleci bugs.
smurrayatwork Oct 8, 2020
2c56f60
Fixes circleci.
smurrayatwork Oct 8, 2020
933ed36
Fixes circleci.
smurrayatwork Oct 8, 2020
fdb9b28
Fixes circleci.
smurrayatwork Oct 8, 2020
0e1f21d
Fixes circleci.
smurrayatwork Oct 8, 2020
f17a711
Updates README file on using rush and rushx commands.
smurrayatwork Oct 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
157 changes: 87 additions & 70 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

version: 2.1


orbs:
php: circleci/[email protected]

references:
configure_npm: &configure_npm
run: { name: 'Configure NPM', command: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'}
Expand All @@ -14,9 +17,9 @@ react_defaults: &react_defaults
docker:
- image: circleci/node:12.18.0-browsers
patternlab_defaults: &patternlab_defaults
working_directory: /var/www/code
working_directory: ~/code
docker:
- image: massgov/drupal-container:1.0.8-ci
- image: cimg/php:7.3-node

backstop_defaults: &backstop_defaults
working_directory: /home/circleci
Expand All @@ -29,17 +32,21 @@ jobs:
steps:
- checkout
- restore_cache:
name: Restore yarn.lock
name: Restore pnpm-lock.yaml
keys:
- root-npm-v3-{{ checksum "yarn.lock" }}
- root-npm-v3-
- run: {name: 'Install packages', command: 'npm i -g yarn && yarn'}
- root-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-2
- run: {name: 'Install packages', command: 'node common/scripts/install-run-rush.js install'}
- save_cache:
name: Save NPM cache
key: root-npm-v3-{{ checksum "yarn.lock" }}
paths: [ node_modules ]
key: root-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-2
paths:
- common
- packages/assets/node_modules
- packages/react/node_modules
- packages/patternlab/styleguide/node_modules
- packages/site/node_modules
- persist_to_workspace:
root: /var/www/code
root: ~/code
paths: ["*"]

patternlab_build:
Expand All @@ -49,16 +56,10 @@ jobs:
- restore_cache:
name: Restore NPM Cache
keys:
- pl-npm-v3-{{ checksum "patternlab/styleguide/package-lock.json" }}
- pl-npm-v3-
- run: { name: 'NPM Install', command: 'cd patternlab/styleguide && npm install' }
- save_cache:
name: Save NPM cache
key: pl-npm-v3-{{ checksum "patternlab/styleguide/package-lock.json" }}
paths: [ patternlab/styleguide/node_modules ]
- run: { name: 'Build', command: 'cd patternlab/styleguide && node_modules/.bin/gulp patternlab:build'}
- root-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-2
- run: { name: 'Build', command: 'cd packages/patternlab/styleguide && node ../../../common/scripts/install-run-rushx.js build'}
- persist_to_workspace:
root: /var/www/code
root: ~/code
paths: ["*"]

patternlab_test:
Expand All @@ -67,37 +68,43 @@ jobs:
- attach_workspace: {at: /home/circleci}
- setup_remote_docker
- run: |
cd patternlab
cd packages/patternlab
docker-compose up --no-start web backstop
docker cp ./ $(docker-compose ps -q backstop):/src/
docker cp ./styleguide/public/. $(docker-compose ps -q web):/usr/share/nginx/html
- run: |
cd patternlab
cd packages/patternlab
docker-compose run backstop test
- run:
command: cd patternlab && docker cp $(docker-compose ps -q backstop):/src/backstopjs/. ./backstopjs/
command: cd packages/patternlab && docker cp $(docker-compose ps -q backstop):/src/backstopjs/. ./backstopjs/
when: always
- store_artifacts:
path: patternlab/backstopjs
path: packages/patternlab/backstopjs
destination: backstop
- store_test_results:
path: patternlab/backstopjs/reports/ci
path: packages/patternlab/backstopjs/reports/ci

patternlab_deploy_branch:
<<: *patternlab_defaults
steps:
- attach_workspace: {at: /var/www/code}
- attach_workspace: {at: ~/code}
- *no_host_check
- add_ssh_keys
- *configure_git
- run:
name: 'Install AWS'
command: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- run:
name: 'Deploy Artifact Branch'
command: |
# This snippet pushes the dist directory to the artifact repo by faking a checkout
# of the artifact repository, creating or reusing an existing branch, committing the
# work, then pushing to github.
# See https://github.com/LastCallMedia/Artifact.sh/blob/master/artifact.sh
cd patternlab/styleguide/dist
cd packages/patternlab/styleguide/dist
git clone --bare [email protected]:massgov/mayflower-artifacts.git .git
git config core.bare false
git rev-parse --verify -q "$CIRCLE_BRANCH" || git branch "$CIRCLE_BRANCH" $(git show-ref -s master)
Expand All @@ -111,12 +118,12 @@ jobs:
fi
- run:
name: 'Deploy S3 Branch'
command: aws s3 sync patternlab/styleguide/public "s3://mayflower.digital.mass.gov/patternlab/b/$CIRCLE_BRANCH"
command: aws s3 sync packages/patternlab/styleguide/public "s3://mayflower.digital.mass.gov/patternlab/b/$CIRCLE_BRANCH"

patternlab_deploy_tag:
<<: *patternlab_defaults
steps:
- attach_workspace: {at: /var/www/code}
- attach_workspace: {at: ~/code}
- *no_host_check
- add_ssh_keys
- *configure_git
Expand All @@ -142,7 +149,7 @@ jobs:
- run:
name: 'Deploy NPM Tag'
command: |
cd patternlab/styleguide/dist
cd packages/patternlab/styleguide/dist
npm version --no-git-tag-version "$CIRCLE_TAG"
if test -z "$(npm show @massds/mayflower@$CIRCLE_TAG)"; then
npm publish
Expand All @@ -164,24 +171,31 @@ jobs:
- checkout
- restore_cache:
keys:
- mfr-dependencies-{{ checksum "react/package.json" }}-4
- run: cd react && npm install
- mfr-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-0
- run:
name: Install Rush on Repo directory
command: node common/scripts/install-run-rush.js install
- save_cache:
name: Save NPM cache
key: mfr-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-0
paths:
- react/node_modules
key: mfr-dependencies-{{ checksum "react/package.json" }}-4
- common
- packages/assets/node_modules
- packages/react/node_modules
- packages/patternlab/styleguide/node_modules
- packages/site/node_modules
- run:
name: Mayflower React Build
command: cd react && npm run build
command: cd packages/react && node ../../common/scripts/install-run-rushx.js build
- run:
name: Mayflower React Build Storybook
command: cd react && npm run build-storybook
command: cd packages/react && node ../../common/scripts/install-run-rushx.js build-storybook
- run:
name: Mayflower React Storybook Extract
command: cd react && npm run storybook:extract
command: cd packages/react && node ../../common/scripts/install-run-rushx.js storybook:extract
- run:
name: Mayflower React Linter
command: cd react && npm run lint
command: cd packages/react && node ../../common/scripts/install-run-rushx.js lint
- persist_to_workspace:
root: ~/repo
paths: ["*"]
Expand All @@ -192,23 +206,23 @@ jobs:
- attach_workspace: {at: /home/circleci}
- setup_remote_docker
- run: |
cd react
cd packages/react
docker-compose up --no-start web backstop
docker cp ./ $(docker-compose ps -q backstop):/src/
docker cp ../assets $(docker-compose ps -q backstop):/src/assets
docker cp ../docs $(docker-compose ps -q backstop):/src/docs
docker cp ../../docs $(docker-compose ps -q backstop):/src/docs
docker cp ./storybook-static/. $(docker-compose ps -q web):/usr/share/nginx/html
- run: |
cd react
cd packages/react
docker-compose run backstop test
- run:
command: cd react && docker cp $(docker-compose ps -q backstop):/src/backstop/. ./backstop/
command: cd packages/react && docker cp $(docker-compose ps -q backstop):/src/backstop/. ./backstop/
when: always
- store_artifacts:
path: react/backstop
path: packages/react/backstop
destination: backstop
- store_test_results:
path: react/backstop/data/ci_report
path: packages/react/backstop/data/ci_report

react_deploy_tag:
<<: *react_defaults
Expand All @@ -219,7 +233,7 @@ jobs:
- run:
name: 'Publish mayflower-react NPM package'
command: |
cd react
cd packages/react
npm version --no-git-tag-version "$CIRCLE_TAG"
if test -z "$(npm show @massds/mayflower-react@$CIRCLE_TAG)"; then
npm publish
Expand All @@ -234,7 +248,7 @@ jobs:
- run: |
# Only sync to S3 for stable tags.
if [[ "$CIRCLE_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
cd react
cd packages/react
aws s3 sync storybook-static s3://mayflower.digital.mass.gov/react --delete
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id $AWS_DISTRIBUTION_ID --paths '/react*'
Expand All @@ -258,7 +272,10 @@ jobs:
steps:
- checkout
- *no_host_check
- run: { name: 'NPM Install', command: 'npm install' }
- restore_cache:
keys:
- root-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-2
- run: sudo npm install -g pnpm @microsoft/rush
# Identify the committer i.e. CircleCI deployment bot
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "CircleCI Deployment Bot"
Expand All @@ -269,7 +286,10 @@ jobs:
steps:
- checkout
- *no_host_check
- run: { name: 'NPM Install', command: 'npm install' }
- restore_cache:
keys:
- root-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-2
- run: sudo npm install -g pnpm @microsoft/rush
# Identify the committer i.e. CircleCI deployment bot
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "CircleCI Deployment Bot"
Expand All @@ -282,15 +302,10 @@ jobs:
- checkout
- restore_cache:
keys:
- assets-dependencies-{{ checksum "assets/package.json" }}
- run: cd assets && npm install
- save_cache:
paths:
- assets/node_modules
key: assets-dependencies-{{ checksum "assets/package.json" }}
- mfr-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-0
- run:
name: Mayflower Style Linter
command: cd assets && npm run stylelint
command: cd packages/assets && node ../../common/scripts/install-run-rushx.js stylelint

assets_deploy_tag:
<<: *react_defaults
Expand All @@ -299,16 +314,11 @@ jobs:
- *configure_npm
- restore_cache:
keys:
- assets-dependencies-{{ checksum "assets/package.json" }}
- run: cd assets && npm i
- save_cache:
paths:
- assets/node_modules
key: assets-dependencies-{{ checksum "assets/package.json" }}
- mfr-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-0
- run:
name: 'Publish mayflower-assets NPM package'
command: |
cd assets
cd packages/assets
npm version --no-git-tag-version "$CIRCLE_TAG"
if test -z "$(npm show @massds/mayflower-assets@$CIRCLE_TAG)"; then
npm publish
Expand All @@ -322,15 +332,11 @@ jobs:
- checkout
- restore_cache:
keys:
- site-dependencies-{{ checksum "site/yarn.lock" }}
- run: {name: 'Install packages', command: 'cd site && yarn'}
- save_cache:
paths:
- site/node_modules
key: site-dependencies-{{ checksum "site/yarn.lock" }}
- mfr-npm-v4-{{ checksum "common/config/rush/pnpm-lock.yaml" }}-0
- run: cd packages/react && node ../../common/scripts/install-run-rushx.js build
- run:
name: Validate Package Build
command: cd site && yarn build
command: cd packages/site && node ../../common/scripts/install-run-rushx.js build
- persist_to_workspace:
root: ~/repo
paths: ["*"]
Expand All @@ -349,7 +355,7 @@ jobs:
- run: |
# Only sync to S3 for stable tags.
if [[ "$CIRCLE_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
cd site
cd packages/site
aws s3 sync public s3://mayflower.digital.mass.gov/home --delete
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id $AWS_DISTRIBUTION_ID --paths '/home*'
Expand All @@ -361,14 +367,17 @@ workflows:
# Executed on branch pushes.
build_branch:
jobs:
- build
- auto_changelog:
filters:
branches: { only: /dependabot\/.*/ }
- assets_build:
requires: [react_build_storybook]
filters:
branches: { ignore: /(docs|site\/).*/ }
# patternlab
- patternlab_build:
requires: [build]
filters:
branches: { ignore: /(docs|react\/|site\/).*/ }
- patternlab_deploy_branch:
Expand All @@ -389,6 +398,7 @@ workflows:
branches: { ignore: /(docs|patternlab\/|site\/).*/ }
# site
- site_build:
requires: [react_build_storybook]
filters:
branches: { ignore: /(docs|patternlab\/|react\/).*/ }

Expand Down Expand Up @@ -429,7 +439,12 @@ workflows:
# Executed on tag pushes.
build_tag:
jobs:
- build:
filters:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
- patternlab_build:
requires: [build]
filters:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
Expand All @@ -448,15 +463,17 @@ workflows:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
- assets_deploy_tag:
requires: [react_build_storybook]
filters:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
- site_build:
requires: [react_build_storybook]
filters:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
- site_deploy_tag:
requires: [site_build]
requires: [react_build_storybook]
filters:
branches: { ignore: /.*/ }
tags: { only: /.*/ }
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Don't allow people to merge changes to these generated files, because the result
# may be invalid. You need to run "rush update" again.
pnpm-lock.yaml merge=binary
shrinkwrap.yaml merge=binary
npm-shrinkwrap.json merge=binary
yarn.lock merge=binary

# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
# may also require a special configuration to allow comments in JSON.
#
# For more information, see this issue: https://github.com/microsoft/rushstack/issues/1088
#
*.json linguist-language=JSON-with-Comments
Loading