diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b2c0a940a7..8c929a74133 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ executors: - image: redis:5.0.8 commands: - bundle-yarn-install: + node-install: steps: - run: name: Switch Node.js version @@ -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: @@ -137,7 +154,9 @@ jobs: executor: ruby_browsers steps: - checkout - - bundle-yarn-install + - node-install + - yarn-install + - bundle-install - run: name: Test Setup command: | @@ -149,7 +168,7 @@ jobs: - public/packs - public/packs-test - build: + ruby_test: executor: ruby_browsers environment: @@ -162,7 +181,9 @@ jobs: steps: - checkout - - bundle-yarn-install + - node-install + - yarn-install + - bundle-install - run: name: Install AWS CLI command: | @@ -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: + 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: | @@ -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: | @@ -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: | @@ -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: | @@ -297,7 +340,9 @@ jobs: MONITOR_ENV: PROD steps: - checkout - - bundle-yarn-install + - node-install + - yarn-install + - bundle-install - run: name: 'Smoke tests' command: | @@ -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: |- @@ -321,12 +368,15 @@ workflows: release: jobs: - setup - - build: + - ruby_test: requires: - setup - javascript_build: requires: - setup + - javascript_test: + requires: + - setup - lints: requires: - setup diff --git a/Makefile b/Makefile index d3a0a7d3213..463ad439fbd 100644 --- a/Makefile +++ b/Makefile @@ -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 ---" @@ -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) diff --git a/deploy/build b/deploy/build index f0c3a8b3842..a2edc74e940 100755 --- a/deploy/build +++ b/deploy/build @@ -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