Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 77 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ executors:
- image: redis:5.0.8

commands:
bundle-yarn-install:
node-install:
steps:
- run:
name: Switch Node.js version
Expand All @@ -42,33 +42,50 @@ commands:
. "$NVM_DIR/nvm.sh" --install
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV;
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV;
- run: gem install bundler --version $BUNDLER_VERSION
- run:
name: Print Node.js version
command: node -v
yarn-install:
steps:
- restore_cache:
keys:
- v2-identity-idp-bundle-{{ checksum "Gemfile.lock" }}
- v1-identity-idp-yarn-{{ checksum "yarn.lock" }}
- v1-identity-idp-yarn-
- run:
name: Install dependencies
command: |
bundle check || bundle install --deployment --jobs=4 --retry=3 --without deploy development doc production --path vendor/bundle
name: Install Yarn
command: yarn install --frozen-lockfile --ignore-engines --cache-folder ~/.cache/yarn
- save_cache:
key: v2-identity-idp-bundle-{{ checksum "Gemfile.lock" }}
key: v1-identity-idp-yarn-{{ checksum "yarn.lock" }}
paths:
- vendor/bundle
- ~/.cache/yarn
yarn-production-install:
steps:
- restore_cache:
keys:
- v1-identity-idp-yarn-{{ checksum "yarn.lock" }}
- v1-identity-idp-yarn-
- v1-identity-idp-yarn-production-{{ checksum "yarn.lock" }}
- v1-identity-idp-yarn-production
- run:
name: Install Yarn
command: yarn install --ignore-engines --cache-folder ~/.cache/yarn
- run:
name: Print Node.js version
command: node -v
command: yarn install --production --frozen-lockfile --ignore-engines --cache-folder ~/.cache/yarn
- save_cache:
key: v1-identity-idp-yarn-{{ checksum "yarn.lock" }}
key: v1-identity-idp-yarn-production-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

bundle-install:
steps:
- run: gem install bundler --version $BUNDLER_VERSION
- restore_cache:
keys:
- v2-identity-idp-bundle-{{ checksum "Gemfile.lock" }}
- run:
name: Install dependencies
command: |
bundle check || bundle install --deployment --jobs=4 --retry=3 --without deploy development doc production --path vendor/bundle
- save_cache:
key: v2-identity-idp-bundle-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
# Custom version of "checkout" that checks out a SHA deployed to sha_url param
# Adapter from https://gist.github.com/drazisil/e97dc21454120251472154de1c1b1c7b
checkout-deployed-sha:
Expand Down Expand Up @@ -137,7 +154,9 @@ jobs:
executor: ruby_browsers
steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: Test Setup
command: |
Expand All @@ -149,7 +168,7 @@ jobs:
- public/packs
- public/packs-test

build:
ruby_test:
executor: ruby_browsers

environment:
Expand All @@ -162,7 +181,9 @@ jobs:

steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: Install AWS CLI
command: |
Expand Down Expand Up @@ -221,23 +242,39 @@ jobs:
command: |
aws s3 sync "s3://login-gov-test-coverage/coverage/$CIRCLE_BUILD_NUM" coverage/
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
javascript_build:
javascript_test:
working_directory: ~/identity-idp
executor: ruby_browsers
steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- run:
name: Run Tests
command: |
yarn test

javascript_build:
Copy link
Copy Markdown
Contributor

@aduth aduth Sep 10, 2021

Choose a reason for hiding this comment

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

I like the name here as far as verifying that we can actually build assets, but it leaves me feeling a bit funny that we have the unprefixed "build" job as meaning something totally different, where it's more about running RSpec tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, changed the build job to be named ruby_test

working_directory: ~/identity-idp
executor: ruby_browsers
steps:
- checkout
- node-install
- yarn-production-install
- bundle-install
- run:
name: Run Tests
command: |
bundle exec rake assets:precompile

lints:
working_directory: ~/identity-idp
executor: ruby_browsers
steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: Run Lints
command: |
Expand All @@ -251,7 +288,9 @@ jobs:
- jq/install
- checkout-deployed-sha:
sha_url: https://idp.dev.identitysandbox.gov/api/deploy.json
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: 'Smoke tests'
command: |
Expand All @@ -267,7 +306,9 @@ jobs:
- jq/install
- checkout-deployed-sha:
sha_url: https://idp.int.identitysandbox.gov/api/deploy.json
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: 'Smoke tests'
command: |
Expand All @@ -283,7 +324,9 @@ jobs:
- jq/install
- checkout-deployed-sha:
sha_url: https://idp.staging.login.gov/api/deploy.json
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: 'Smoke tests'
command: |
Expand All @@ -297,7 +340,9 @@ jobs:
MONITOR_ENV: PROD
steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: 'Smoke tests'
command: |
Expand All @@ -308,7 +353,9 @@ jobs:
executor: ruby_browsers
steps:
- checkout
- bundle-yarn-install
- node-install
- yarn-install
- bundle-install
- run:
name: Check current AWS Pinpoint country support
command: |-
Expand All @@ -321,12 +368,15 @@ workflows:
release:
jobs:
- setup
- build:
- ruby_test:
requires:
- setup
- javascript_build:
requires:
- setup
- javascript_test:
requires:
- setup
- lints:
requires:
- setup
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ lint:
@echo "--- bundler-audit ---"
bundle exec bundler-audit check --update
# JavaScript
@echo "--- lint yarn lockfile ---"
make lint_yarn_lockfile
@echo "--- eslint ---"
yarn run lint
@echo "--- typescript ---"
Expand All @@ -55,9 +53,6 @@ lint:
lint_erb:
bundle exec erblint app/views

lint_yarn_lockfile:
(! git diff --name-only | grep yarn.lock) || (echo "Error: Sync Yarn lockfile using 'yarn install'"; exit 1)

lint_yaml: normalize_yaml
(! git diff --name-only | grep "^config/.*\.yml$$") || (echo "Error: Run 'make normalize_yaml' to normalize YAML"; exit 1)

Expand Down
2 changes: 1 addition & 1 deletion deploy/build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bundle install --deployment --jobs 4 \
--binstubs "$bundle_dir/bin" \
--without 'deploy development doc test'

bundle exec yarn install
yarn install --production --frozen-lockfile

set +x

Expand Down