From 7cf7788ef3c4ecc0e99a459939b8fc180795d47f Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 16:30:49 -0500 Subject: [PATCH 01/16] Add redis to workflow --- .github/workflows/make-docs.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 1cfc1e1dda5..91f669c27fb 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -2,8 +2,13 @@ name: Make-docs-to-webpage # Trigger running when a PR is closed on: + # pull_request: + # types: [ closed ] + + # Temp addition for testing + workflow_dispatch: pull_request: - types: [ closed ] + types: [opened, reopened, synchronize] jobs: make_docs: @@ -13,13 +18,21 @@ jobs: runs-on: ubuntu-latest services: postgres: - image: postgres:11 + image: postgres:14.8 env: POSTGRES_DB: caseflow_certification_test POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: ["5432:5432"] + redis: + image: redis:2.8.23 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: ["6379:6379"] steps: - name: Debugging info From 846572b8ebc074558c49b61fb2586617de2b99f2 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 16:33:45 -0500 Subject: [PATCH 02/16] Temporarily comment out the if statement --- .github/workflows/make-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 91f669c27fb..5f445810dbf 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -14,7 +14,7 @@ jobs: make_docs: name: Update DB schema files in webpage # Only run if the PR has been merged (rather than simply closed) - if: github.event.pull_request.merged == true + # if: github.event.pull_request.merged == true runs-on: ubuntu-latest services: postgres: From 5eb2bd45031af56391e9e229766d64834de7cf00 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 17:08:17 -0500 Subject: [PATCH 03/16] Add missing polymorphic association --- lib/tasks/support/jailer_polymorphic_associations.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/support/jailer_polymorphic_associations.rb b/lib/tasks/support/jailer_polymorphic_associations.rb index 806fbcf5161..9237de94cd3 100644 --- a/lib/tasks/support/jailer_polymorphic_associations.rb +++ b/lib/tasks/support/jailer_polymorphic_associations.rb @@ -19,7 +19,8 @@ def polymorphic_types_hash "EndProductUpdate.original_decision_review_type" => [SupplementalClaim, HigherLevelReview], "JobNote.job_type" => [SupplementalClaim, HigherLevelReview], "hearing_type" => [Hearing, LegacyHearing], - "assigned_to_type" => [User, Organization] + "assigned_to_type" => [User, Organization], + "stuck_record" => [PriorityEndProductSyncQueue] }.freeze end From 451fa1803758fd048be9bdcfabefba9e9922f369 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 17:11:17 -0500 Subject: [PATCH 04/16] Add missing polymorphic association correctly this time --- lib/tasks/support/jailer_polymorphic_associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/support/jailer_polymorphic_associations.rb b/lib/tasks/support/jailer_polymorphic_associations.rb index 9237de94cd3..2b30e2175b9 100644 --- a/lib/tasks/support/jailer_polymorphic_associations.rb +++ b/lib/tasks/support/jailer_polymorphic_associations.rb @@ -20,7 +20,7 @@ def polymorphic_types_hash "JobNote.job_type" => [SupplementalClaim, HigherLevelReview], "hearing_type" => [Hearing, LegacyHearing], "assigned_to_type" => [User, Organization], - "stuck_record" => [PriorityEndProductSyncQueue] + "CaseflowStuckRecord.stuck_record" => [PriorityEndProductSyncQueue] }.freeze end From 282c94edc8306f76658aafacc29591bcaa470e39 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 17:16:03 -0500 Subject: [PATCH 05/16] Add missing polymorphic association correctly this time --- lib/tasks/support/jailer_polymorphic_associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/support/jailer_polymorphic_associations.rb b/lib/tasks/support/jailer_polymorphic_associations.rb index 2b30e2175b9..4da3df03d13 100644 --- a/lib/tasks/support/jailer_polymorphic_associations.rb +++ b/lib/tasks/support/jailer_polymorphic_associations.rb @@ -20,7 +20,7 @@ def polymorphic_types_hash "JobNote.job_type" => [SupplementalClaim, HigherLevelReview], "hearing_type" => [Hearing, LegacyHearing], "assigned_to_type" => [User, Organization], - "CaseflowStuckRecord.stuck_record" => [PriorityEndProductSyncQueue] + "CaseflowStuckRecord.stuck_record_type" => [PriorityEndProductSyncQueue] }.freeze end From 6ae547bc6f604f9a8e47c9b53f2420117b3199ca Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 17:23:26 -0500 Subject: [PATCH 06/16] Add another missing association --- lib/tasks/support/jailer_polymorphic_associations.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/support/jailer_polymorphic_associations.rb b/lib/tasks/support/jailer_polymorphic_associations.rb index 4da3df03d13..496bb9d4ecf 100644 --- a/lib/tasks/support/jailer_polymorphic_associations.rb +++ b/lib/tasks/support/jailer_polymorphic_associations.rb @@ -20,7 +20,8 @@ def polymorphic_types_hash "JobNote.job_type" => [SupplementalClaim, HigherLevelReview], "hearing_type" => [Hearing, LegacyHearing], "assigned_to_type" => [User, Organization], - "CaseflowStuckRecord.stuck_record_type" => [PriorityEndProductSyncQueue] + "CaseflowStuckRecord.stuck_record_type" => [PriorityEndProductSyncQueue], + "VbmsCommunicationPackage.document_mailable_via_pacman_type" => [DecisionDocument, VbmsUploadedDocument] }.freeze end From 144efb4ad68176fd6e889ca3e9b8acb4778aae9d Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 17:49:40 -0500 Subject: [PATCH 07/16] Add git push --- .github/workflows/make-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 5f445810dbf..47dae3b7ad7 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -164,6 +164,6 @@ jobs: echo "::group::Committing changes locally" git config --local user.email "$WIKI_COMMIT_USER_EMAIL" git config --local user.name "$WIKI_COMMIT_USER_NAME" - git commit -m "$WIKI_COMMIT_MESSAGE" + git commit -m "$WIKI_COMMIT_MESSAGE" && git push echo "::endgroup::" fi From 7d11a983d2c059fa55a6184ebbc5d929597196d8 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Thu, 28 Dec 2023 21:22:58 -0500 Subject: [PATCH 08/16] Turn off main CI workflow for now --- .github/workflows/workflow.yml | 688 ++++++++++++++++----------------- 1 file changed, 344 insertions(+), 344 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 224d0b7488e..36912218622 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,345 +1,345 @@ -name: RSpec Jest Lint Workflow - -on: - workflow_dispatch: - pull_request: - types: [opened, reopened, synchronize] - -# Use this flag to turn on/off RSpec. Please go to the lint & js_test job to disable the boolean -env: - rspec_active: true - FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color - -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -jobs: - # This job runs the main deployment of caseflow - caseflow_rspec_job: - runs-on: ubuntu-8-cores-latest - timeout-minutes: 45 - services: - postgres: - image: postgres:14.8 - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: password - POSTGRES_DB: caseflow_certification_test - - ports: - - 5432:5432 - - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - redis: - image: redis:4.0.10 - ports: - - 6379:6379 - - facols_db: - image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/facols:latest - credentials: - username: AWS - password: ${{ secrets.ECR_PASSWORD }} - ports: - - 1521:1521 - - strategy: - fail-fast: false - matrix: - ci_node_total: [12] - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - - container: - image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers - options: --privileged # Necessary for Rspec to run with our configuration within GHA - credentials: - username: AWS - password: ${{ secrets.ECR_PASSWORD }} - - env: - DBUS_SESSION_BUS_ADDRESS: /dev/null - RAILS_ENV: test - NODE_ENV: test - BUNDLE_PATH: vendor/bundle - COVERAGE_DIR: /home/circleci/coverage-${{matrix.ci_node_index}} #circleci is the USER - POSTGRES_HOST: postgres - POSTGRES_USER: root - POSTGRES_PASSWORD: password - KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true - WD_INSTALL_DIR: .webdrivers - CI: true - REDIS_URL_CACHE: redis://redis:6379/0/cache/ - TEST_VACOLS_HOST: facols_db - - steps: - - uses: actions/checkout@v3 - - # If we don't explicitly set this, the runner doesn't find the path when trying to save the cache - - name: Set yarn cache directory - id: set-yarn-cache-dir - run: mkdir -p ~/.cache/yarn && yarn config set cache-folder ~/.cache/yarn - - - name: restore yarn cache - id: cache-yarn-cache - uses: actions/cache/restore@v3 - with: - # hashFiles('client/yarn.lock') will use a unique cache based on dependencies so that we don't - # create a cache for each target branch - key: yarn-cache-${{ hashFiles('client/yarn.lock') }} - # We are including node_modules because most of the time is used to build the dependencies - path: | - node_modules - client/node_modules - ~/.cache/yarn - restore-keys: yarn-cache-${{ hashFiles('client/yarn.lock') }} - - # We run yarn install after loading the cache to update any dependencies if their version is different - - name: Install Node Dependencies - run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile --prefer-offline" - - - name: Save Yarn Cache - if: steps.cache-yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - key: yarn-cache-${{ hashFiles('client/yarn.lock') }} - path: | - node_modules - client/node_modules - ~/.cache/yarn - - - name: setup testfiles directory - run: ./ci-bin/capture-log "mkdir -p tmp/testfiles" - - - name: Install Chrome - run: | - apt-get update - wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ - && apt install -y /tmp/chrome.deb \ - && rm /tmp/chrome.deb - echo "Chrome exe name: $(ls /usr/bin | chrome)" - echo "Chrome version: $(google-chrome --version)" - - # wkhtmltopdf is a required library for certain rspec tests to pass - - name: Restore wkhtmltopdf - id: cache-wkhtmltopdf - uses: actions/cache/restore@v3 - with: - key: ${{ runner.os }}-wkhtmltopdf - path: wkhtmltox_0.12.6-1.focal_amd64.deb - - - name: Download wkhtmltopdf - if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' - run: wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb - - - name: Install wkhtmltopdf - run: apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb - - - name: Cache wkhtmltopdf - if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - key: ${{ runner.os }}-wkhtmltopdf - path: wkhtmltox_0.12.6-1.focal_amd64.deb - - - name: Restore Ruby Dependencies - id: cache-ruby-dependencies - uses: actions/cache/restore@v3 - with: - key: bundler-gems - path: vendor/bundle - restore-keys: bundler-gems - - - name: Install/Update Ruby Dependencies - run: | - ruby -v - BASH_ENV="Bash" - echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> "$BASH_ENV" - export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") - gem install bundler - bundle install --path vendor/bundle - - - name: Cache Ruby Dependencies - if: steps.cache-ruby-dependencies.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - key: bundler-gems - path: vendor/bundle - - - name: Install Dockerize - run: | - DOCKERIZE_VERSION="v0.6.1" - wget https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ - && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ - && rm dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz - - - name: "Wait for database" - run: dockerize -wait tcp://postgres:5432 -timeout 1m - - - name: "Wait for FACOLS" - run: ./ci-bin/capture-log "bundle exec rake local:vacols:wait_for_connection" - - - name: Database setup - run: | - ./ci-bin/capture-log "DB=etl bundle exec rake db:create db:schema:load db:migrate" - ./ci-bin/capture-log "bundle exec rake db:create db:schema:load db:migrate" - ./ci-bin/capture-log "make -f Makefile.example external-db-create" - # added line to create external table(s) that are needed for tests - - # We don't want to seed DBs here because DatabaseCleaner just truncates it anyway. The setup_vacols - # rake task needs to be run because it adds data to two tables that are ignored by DBCleaner - - name: Seed databases - run: | - ./ci-bin/capture-log "bundle exec rake spec:setup_vacols" - - - name: Assets Precompile - run: | - ./ci-bin/capture-log "bundle exec rake assets:precompile" - - # Changing the user and permissions as Chrome/Chromedriver can't run as root - - name: RSpec via knapsack_pro Queue Mode - run: | - mkdir -p ./test-results/rspec - mkdir .webdrivers - touch log/selenium-chrome.log - chmod -R 777 ${GITHUB_WORKSPACE} - export GHA_NODE_INDEX=${{matrix.ci_node_index}} - runuser -u circleci bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RSpec::Github::Formatter --tty]" - # --format RSpec::Github::Formatter use in Rspec-github gem, adds more detailed info to GHA "Annotations" - # --tty forces Rspec to produce color - # circleci is the USER - - - # Artifacts --- circleci is the USER - - run: (cd /home/circleci && tar -zcvf coverage-${{matrix.ci_node_index}}.tar.gz coverage-${{matrix.ci_node_index}}) - - uses: actions/upload-artifact@v3 - if: success() - with: - path: /home/circleci/coverage-${{matrix.ci_node_index}}.tar.gz #circleci is the USER - - - uses: actions/upload-artifact@v3 - # Run even if there is a failure in the previous steps, but not if the run is cancelled - if: success() || failure() - name: capybara-artifacts - with: - path: ./tmp/capybara - - - name: Compress test logs - if: failure() - run: tar -czvf ./log/test-${{matrix.ci_node_index}}.log.tar.gz ./log/test.log - - uses: actions/upload-artifact@v3 - if: failure() - name: Upload test logs if failure - with: - path: ./log/test-${{matrix.ci_node_index}}.log.tar.gz - - - run: cp ./log/bullet.log ./log/bullet-${{matrix.ci_node_index}}.log - - uses: actions/upload-artifact@v3 - if: success() || failure() - name: bullet-${{matrix.ci_node_index}}.log - with: - path: ./log/bullet-${{matrix.ci_node_index}}.log - - - - caseflow_jest_job: - # This job will run the jest, change the value below to false if you wish to turn it off. - if: true - runs-on: ubuntu-latest - container: - image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers - credentials: - username: AWS - password: ${{ secrets.ECR_PASSWORD }} - env: - DBUS_SESSION_BUS_ADDRESS: /dev/null - RAILS_ENV: test - NODE_ENV: test - JEST_DIR: /home/circleci/test-results/jest #circleci is the USER - TEST_REPORTER: jest-junit - JEST_JUNIT_OUTPUT_DIR: /home/circleci/test-results/jest #circleci is the USER - COVERAGE_DIR: /home/circleci/coverage #circleci is the USER - - steps: - - name: Install Chrome - run: | - apt-get update - wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ - && apt install -y /tmp/chrome.deb \ - && rm /tmp/chrome.deb - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Python-2 - run: | - sudo apt-get update - sudo apt-get install -y python2 - - - name: install_node_dependencies - run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" - - - name: jest - shell: bash - run: | - npm install --save-dev jest - mkdir -p ./test-results/jest - pushd client - ../ci-bin/capture-log "node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4" - - - name: store_test_results - uses: actions/upload-artifact@v3 - with: - path: ./test-results - - - name: store logs - uses: actions/upload-artifact@v3 - with: - path: ./all_logs.log - - - - caseflow_lint_job: - # This job will run the security lint checker, change the value below to false if you wish to turn it off. - if: true - runs-on: ubuntu-latest - container: - image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers - credentials: - username: AWS - password: ${{ secrets.ECR_PASSWORD }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' - - - name: Install Ruby Dependencies - run: | - ruby -v - BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ") - echo $BUNDLER_V - gem install bundler:$BUNDLER_V - bundle install --path vendor/bundle - - name: Install Node Dependencies - run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" - - # - name: Danger - # run: ./ci-bin/capture-log "bundle exec danger" - # env: - # DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} - - - name: Lint - run: ./ci-bin/capture-log "bundle exec rake lint" - if: ${{ always() }} - - # - name: Security - # run: ./ci-bin/capture-log "bundle exec rake security" - # if: ${{ always() }} +# name: RSpec Jest Lint Workflow + +# on: +# workflow_dispatch: +# pull_request: +# types: [opened, reopened, synchronize] + +# # Use this flag to turn on/off RSpec. Please go to the lint & js_test job to disable the boolean +# env: +# rspec_active: true +# FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color + +# concurrency: +# group: ${{ github.ref }} +# cancel-in-progress: true + +# jobs: +# # This job runs the main deployment of caseflow +# caseflow_rspec_job: +# runs-on: ubuntu-8-cores-latest +# timeout-minutes: 45 +# services: +# postgres: +# image: postgres:14.8 +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: password +# POSTGRES_DB: caseflow_certification_test + +# ports: +# - 5432:5432 + +# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + +# redis: +# image: redis:4.0.10 +# ports: +# - 6379:6379 + +# facols_db: +# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/facols:latest +# credentials: +# username: AWS +# password: ${{ secrets.ECR_PASSWORD }} +# ports: +# - 1521:1521 + +# strategy: +# fail-fast: false +# matrix: +# ci_node_total: [12] +# ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + +# container: +# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers +# options: --privileged # Necessary for Rspec to run with our configuration within GHA +# credentials: +# username: AWS +# password: ${{ secrets.ECR_PASSWORD }} + +# env: +# DBUS_SESSION_BUS_ADDRESS: /dev/null +# RAILS_ENV: test +# NODE_ENV: test +# BUNDLE_PATH: vendor/bundle +# COVERAGE_DIR: /home/circleci/coverage-${{matrix.ci_node_index}} #circleci is the USER +# POSTGRES_HOST: postgres +# POSTGRES_USER: root +# POSTGRES_PASSWORD: password +# KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true +# KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} +# KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} +# KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} +# KNAPSACK_PRO_LOG_LEVEL: info +# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true +# WD_INSTALL_DIR: .webdrivers +# CI: true +# REDIS_URL_CACHE: redis://redis:6379/0/cache/ +# TEST_VACOLS_HOST: facols_db + +# steps: +# - uses: actions/checkout@v3 + +# # If we don't explicitly set this, the runner doesn't find the path when trying to save the cache +# - name: Set yarn cache directory +# id: set-yarn-cache-dir +# run: mkdir -p ~/.cache/yarn && yarn config set cache-folder ~/.cache/yarn + +# - name: restore yarn cache +# id: cache-yarn-cache +# uses: actions/cache/restore@v3 +# with: +# # hashFiles('client/yarn.lock') will use a unique cache based on dependencies so that we don't +# # create a cache for each target branch +# key: yarn-cache-${{ hashFiles('client/yarn.lock') }} +# # We are including node_modules because most of the time is used to build the dependencies +# path: | +# node_modules +# client/node_modules +# ~/.cache/yarn +# restore-keys: yarn-cache-${{ hashFiles('client/yarn.lock') }} + +# # We run yarn install after loading the cache to update any dependencies if their version is different +# - name: Install Node Dependencies +# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile --prefer-offline" + +# - name: Save Yarn Cache +# if: steps.cache-yarn-cache.outputs.cache-hit != 'true' +# uses: actions/cache/save@v3 +# with: +# key: yarn-cache-${{ hashFiles('client/yarn.lock') }} +# path: | +# node_modules +# client/node_modules +# ~/.cache/yarn + +# - name: setup testfiles directory +# run: ./ci-bin/capture-log "mkdir -p tmp/testfiles" + +# - name: Install Chrome +# run: | +# apt-get update +# wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ +# && apt install -y /tmp/chrome.deb \ +# && rm /tmp/chrome.deb +# echo "Chrome exe name: $(ls /usr/bin | chrome)" +# echo "Chrome version: $(google-chrome --version)" + +# # wkhtmltopdf is a required library for certain rspec tests to pass +# - name: Restore wkhtmltopdf +# id: cache-wkhtmltopdf +# uses: actions/cache/restore@v3 +# with: +# key: ${{ runner.os }}-wkhtmltopdf +# path: wkhtmltox_0.12.6-1.focal_amd64.deb + +# - name: Download wkhtmltopdf +# if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' +# run: wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb + +# - name: Install wkhtmltopdf +# run: apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb + +# - name: Cache wkhtmltopdf +# if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' +# uses: actions/cache/save@v3 +# with: +# key: ${{ runner.os }}-wkhtmltopdf +# path: wkhtmltox_0.12.6-1.focal_amd64.deb + +# - name: Restore Ruby Dependencies +# id: cache-ruby-dependencies +# uses: actions/cache/restore@v3 +# with: +# key: bundler-gems +# path: vendor/bundle +# restore-keys: bundler-gems + +# - name: Install/Update Ruby Dependencies +# run: | +# ruby -v +# BASH_ENV="Bash" +# echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> "$BASH_ENV" +# export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") +# gem install bundler +# bundle install --path vendor/bundle + +# - name: Cache Ruby Dependencies +# if: steps.cache-ruby-dependencies.outputs.cache-hit != 'true' +# uses: actions/cache/save@v3 +# with: +# key: bundler-gems +# path: vendor/bundle + +# - name: Install Dockerize +# run: | +# DOCKERIZE_VERSION="v0.6.1" +# wget https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ +# && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ +# && rm dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz + +# - name: "Wait for database" +# run: dockerize -wait tcp://postgres:5432 -timeout 1m + +# - name: "Wait for FACOLS" +# run: ./ci-bin/capture-log "bundle exec rake local:vacols:wait_for_connection" + +# - name: Database setup +# run: | +# ./ci-bin/capture-log "DB=etl bundle exec rake db:create db:schema:load db:migrate" +# ./ci-bin/capture-log "bundle exec rake db:create db:schema:load db:migrate" +# ./ci-bin/capture-log "make -f Makefile.example external-db-create" +# # added line to create external table(s) that are needed for tests + +# # We don't want to seed DBs here because DatabaseCleaner just truncates it anyway. The setup_vacols +# # rake task needs to be run because it adds data to two tables that are ignored by DBCleaner +# - name: Seed databases +# run: | +# ./ci-bin/capture-log "bundle exec rake spec:setup_vacols" + +# - name: Assets Precompile +# run: | +# ./ci-bin/capture-log "bundle exec rake assets:precompile" + +# # Changing the user and permissions as Chrome/Chromedriver can't run as root +# - name: RSpec via knapsack_pro Queue Mode +# run: | +# mkdir -p ./test-results/rspec +# mkdir .webdrivers +# touch log/selenium-chrome.log +# chmod -R 777 ${GITHUB_WORKSPACE} +# export GHA_NODE_INDEX=${{matrix.ci_node_index}} +# runuser -u circleci bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RSpec::Github::Formatter --tty]" +# # --format RSpec::Github::Formatter use in Rspec-github gem, adds more detailed info to GHA "Annotations" +# # --tty forces Rspec to produce color +# # circleci is the USER + + +# # Artifacts --- circleci is the USER +# - run: (cd /home/circleci && tar -zcvf coverage-${{matrix.ci_node_index}}.tar.gz coverage-${{matrix.ci_node_index}}) +# - uses: actions/upload-artifact@v3 +# if: success() +# with: +# path: /home/circleci/coverage-${{matrix.ci_node_index}}.tar.gz #circleci is the USER + +# - uses: actions/upload-artifact@v3 +# # Run even if there is a failure in the previous steps, but not if the run is cancelled +# if: success() || failure() +# name: capybara-artifacts +# with: +# path: ./tmp/capybara + +# - name: Compress test logs +# if: failure() +# run: tar -czvf ./log/test-${{matrix.ci_node_index}}.log.tar.gz ./log/test.log +# - uses: actions/upload-artifact@v3 +# if: failure() +# name: Upload test logs if failure +# with: +# path: ./log/test-${{matrix.ci_node_index}}.log.tar.gz + +# - run: cp ./log/bullet.log ./log/bullet-${{matrix.ci_node_index}}.log +# - uses: actions/upload-artifact@v3 +# if: success() || failure() +# name: bullet-${{matrix.ci_node_index}}.log +# with: +# path: ./log/bullet-${{matrix.ci_node_index}}.log + + + +# caseflow_jest_job: +# # This job will run the jest, change the value below to false if you wish to turn it off. +# if: true +# runs-on: ubuntu-latest +# container: +# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers +# credentials: +# username: AWS +# password: ${{ secrets.ECR_PASSWORD }} +# env: +# DBUS_SESSION_BUS_ADDRESS: /dev/null +# RAILS_ENV: test +# NODE_ENV: test +# JEST_DIR: /home/circleci/test-results/jest #circleci is the USER +# TEST_REPORTER: jest-junit +# JEST_JUNIT_OUTPUT_DIR: /home/circleci/test-results/jest #circleci is the USER +# COVERAGE_DIR: /home/circleci/coverage #circleci is the USER + +# steps: +# - name: Install Chrome +# run: | +# apt-get update +# wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ +# && apt install -y /tmp/chrome.deb \ +# && rm /tmp/chrome.deb +# - name: Checkout +# uses: actions/checkout@v3 + +# - name: Install Python-2 +# run: | +# sudo apt-get update +# sudo apt-get install -y python2 + +# - name: install_node_dependencies +# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" + +# - name: jest +# shell: bash +# run: | +# npm install --save-dev jest +# mkdir -p ./test-results/jest +# pushd client +# ../ci-bin/capture-log "node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4" + +# - name: store_test_results +# uses: actions/upload-artifact@v3 +# with: +# path: ./test-results + +# - name: store logs +# uses: actions/upload-artifact@v3 +# with: +# path: ./all_logs.log + + + +# caseflow_lint_job: +# # This job will run the security lint checker, change the value below to false if you wish to turn it off. +# if: true +# runs-on: ubuntu-latest +# container: +# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers +# credentials: +# username: AWS +# password: ${{ secrets.ECR_PASSWORD }} + +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# fetch-depth: '0' + +# - name: Install Ruby Dependencies +# run: | +# ruby -v +# BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ") +# echo $BUNDLER_V +# gem install bundler:$BUNDLER_V +# bundle install --path vendor/bundle +# - name: Install Node Dependencies +# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" + +# # - name: Danger +# # run: ./ci-bin/capture-log "bundle exec danger" +# # env: +# # DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} + +# - name: Lint +# run: ./ci-bin/capture-log "bundle exec rake lint" +# if: ${{ always() }} + +# # - name: Security +# # run: ./ci-bin/capture-log "bundle exec rake security" +# # if: ${{ always() }} From ee0fc1a26a1548e239e8f9cff559e4baabadd601 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Fri, 29 Dec 2023 08:47:56 -0500 Subject: [PATCH 09/16] Set workflow settings back to what they were --- .github/workflows/make-docs.yml | 7 +- .github/workflows/workflow.yml | 684 ++++++++++++++++---------------- 2 files changed, 340 insertions(+), 351 deletions(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 47dae3b7ad7..09ea2fcfb3b 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -2,13 +2,8 @@ name: Make-docs-to-webpage # Trigger running when a PR is closed on: - # pull_request: - # types: [ closed ] - - # Temp addition for testing - workflow_dispatch: pull_request: - types: [opened, reopened, synchronize] + types: [ closed ] jobs: make_docs: diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 36912218622..5b5b681b54f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,345 +1,339 @@ -# name: RSpec Jest Lint Workflow - -# on: -# workflow_dispatch: -# pull_request: -# types: [opened, reopened, synchronize] - -# # Use this flag to turn on/off RSpec. Please go to the lint & js_test job to disable the boolean -# env: -# rspec_active: true -# FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color - -# concurrency: -# group: ${{ github.ref }} -# cancel-in-progress: true - -# jobs: -# # This job runs the main deployment of caseflow -# caseflow_rspec_job: -# runs-on: ubuntu-8-cores-latest -# timeout-minutes: 45 -# services: -# postgres: -# image: postgres:14.8 -# env: -# POSTGRES_USER: root -# POSTGRES_PASSWORD: password -# POSTGRES_DB: caseflow_certification_test - -# ports: -# - 5432:5432 - -# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - -# redis: -# image: redis:4.0.10 -# ports: -# - 6379:6379 - -# facols_db: -# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/facols:latest -# credentials: -# username: AWS -# password: ${{ secrets.ECR_PASSWORD }} -# ports: -# - 1521:1521 - -# strategy: -# fail-fast: false -# matrix: -# ci_node_total: [12] -# ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - -# container: -# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers -# options: --privileged # Necessary for Rspec to run with our configuration within GHA -# credentials: -# username: AWS -# password: ${{ secrets.ECR_PASSWORD }} - -# env: -# DBUS_SESSION_BUS_ADDRESS: /dev/null -# RAILS_ENV: test -# NODE_ENV: test -# BUNDLE_PATH: vendor/bundle -# COVERAGE_DIR: /home/circleci/coverage-${{matrix.ci_node_index}} #circleci is the USER -# POSTGRES_HOST: postgres -# POSTGRES_USER: root -# POSTGRES_PASSWORD: password -# KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true -# KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} -# KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} -# KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} -# KNAPSACK_PRO_LOG_LEVEL: info -# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true -# WD_INSTALL_DIR: .webdrivers -# CI: true -# REDIS_URL_CACHE: redis://redis:6379/0/cache/ -# TEST_VACOLS_HOST: facols_db - -# steps: -# - uses: actions/checkout@v3 - -# # If we don't explicitly set this, the runner doesn't find the path when trying to save the cache -# - name: Set yarn cache directory -# id: set-yarn-cache-dir -# run: mkdir -p ~/.cache/yarn && yarn config set cache-folder ~/.cache/yarn - -# - name: restore yarn cache -# id: cache-yarn-cache -# uses: actions/cache/restore@v3 -# with: -# # hashFiles('client/yarn.lock') will use a unique cache based on dependencies so that we don't -# # create a cache for each target branch -# key: yarn-cache-${{ hashFiles('client/yarn.lock') }} -# # We are including node_modules because most of the time is used to build the dependencies -# path: | -# node_modules -# client/node_modules -# ~/.cache/yarn -# restore-keys: yarn-cache-${{ hashFiles('client/yarn.lock') }} - -# # We run yarn install after loading the cache to update any dependencies if their version is different -# - name: Install Node Dependencies -# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile --prefer-offline" - -# - name: Save Yarn Cache -# if: steps.cache-yarn-cache.outputs.cache-hit != 'true' -# uses: actions/cache/save@v3 -# with: -# key: yarn-cache-${{ hashFiles('client/yarn.lock') }} -# path: | -# node_modules -# client/node_modules -# ~/.cache/yarn - -# - name: setup testfiles directory -# run: ./ci-bin/capture-log "mkdir -p tmp/testfiles" - -# - name: Install Chrome -# run: | -# apt-get update -# wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ -# && apt install -y /tmp/chrome.deb \ -# && rm /tmp/chrome.deb -# echo "Chrome exe name: $(ls /usr/bin | chrome)" -# echo "Chrome version: $(google-chrome --version)" - -# # wkhtmltopdf is a required library for certain rspec tests to pass -# - name: Restore wkhtmltopdf -# id: cache-wkhtmltopdf -# uses: actions/cache/restore@v3 -# with: -# key: ${{ runner.os }}-wkhtmltopdf -# path: wkhtmltox_0.12.6-1.focal_amd64.deb - -# - name: Download wkhtmltopdf -# if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' -# run: wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb - -# - name: Install wkhtmltopdf -# run: apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb - -# - name: Cache wkhtmltopdf -# if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' -# uses: actions/cache/save@v3 -# with: -# key: ${{ runner.os }}-wkhtmltopdf -# path: wkhtmltox_0.12.6-1.focal_amd64.deb - -# - name: Restore Ruby Dependencies -# id: cache-ruby-dependencies -# uses: actions/cache/restore@v3 -# with: -# key: bundler-gems -# path: vendor/bundle -# restore-keys: bundler-gems - -# - name: Install/Update Ruby Dependencies -# run: | -# ruby -v -# BASH_ENV="Bash" -# echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> "$BASH_ENV" -# export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") -# gem install bundler -# bundle install --path vendor/bundle - -# - name: Cache Ruby Dependencies -# if: steps.cache-ruby-dependencies.outputs.cache-hit != 'true' -# uses: actions/cache/save@v3 -# with: -# key: bundler-gems -# path: vendor/bundle - -# - name: Install Dockerize -# run: | -# DOCKERIZE_VERSION="v0.6.1" -# wget https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ -# && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ -# && rm dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz - -# - name: "Wait for database" -# run: dockerize -wait tcp://postgres:5432 -timeout 1m - -# - name: "Wait for FACOLS" -# run: ./ci-bin/capture-log "bundle exec rake local:vacols:wait_for_connection" - -# - name: Database setup -# run: | -# ./ci-bin/capture-log "DB=etl bundle exec rake db:create db:schema:load db:migrate" -# ./ci-bin/capture-log "bundle exec rake db:create db:schema:load db:migrate" -# ./ci-bin/capture-log "make -f Makefile.example external-db-create" -# # added line to create external table(s) that are needed for tests - -# # We don't want to seed DBs here because DatabaseCleaner just truncates it anyway. The setup_vacols -# # rake task needs to be run because it adds data to two tables that are ignored by DBCleaner -# - name: Seed databases -# run: | -# ./ci-bin/capture-log "bundle exec rake spec:setup_vacols" - -# - name: Assets Precompile -# run: | -# ./ci-bin/capture-log "bundle exec rake assets:precompile" - -# # Changing the user and permissions as Chrome/Chromedriver can't run as root -# - name: RSpec via knapsack_pro Queue Mode -# run: | -# mkdir -p ./test-results/rspec -# mkdir .webdrivers -# touch log/selenium-chrome.log -# chmod -R 777 ${GITHUB_WORKSPACE} -# export GHA_NODE_INDEX=${{matrix.ci_node_index}} -# runuser -u circleci bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RSpec::Github::Formatter --tty]" -# # --format RSpec::Github::Formatter use in Rspec-github gem, adds more detailed info to GHA "Annotations" -# # --tty forces Rspec to produce color -# # circleci is the USER - - -# # Artifacts --- circleci is the USER -# - run: (cd /home/circleci && tar -zcvf coverage-${{matrix.ci_node_index}}.tar.gz coverage-${{matrix.ci_node_index}}) -# - uses: actions/upload-artifact@v3 -# if: success() -# with: -# path: /home/circleci/coverage-${{matrix.ci_node_index}}.tar.gz #circleci is the USER - -# - uses: actions/upload-artifact@v3 -# # Run even if there is a failure in the previous steps, but not if the run is cancelled -# if: success() || failure() -# name: capybara-artifacts -# with: -# path: ./tmp/capybara - -# - name: Compress test logs -# if: failure() -# run: tar -czvf ./log/test-${{matrix.ci_node_index}}.log.tar.gz ./log/test.log -# - uses: actions/upload-artifact@v3 -# if: failure() -# name: Upload test logs if failure -# with: -# path: ./log/test-${{matrix.ci_node_index}}.log.tar.gz - -# - run: cp ./log/bullet.log ./log/bullet-${{matrix.ci_node_index}}.log -# - uses: actions/upload-artifact@v3 -# if: success() || failure() -# name: bullet-${{matrix.ci_node_index}}.log -# with: -# path: ./log/bullet-${{matrix.ci_node_index}}.log - - - -# caseflow_jest_job: -# # This job will run the jest, change the value below to false if you wish to turn it off. -# if: true -# runs-on: ubuntu-latest -# container: -# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers -# credentials: -# username: AWS -# password: ${{ secrets.ECR_PASSWORD }} -# env: -# DBUS_SESSION_BUS_ADDRESS: /dev/null -# RAILS_ENV: test -# NODE_ENV: test -# JEST_DIR: /home/circleci/test-results/jest #circleci is the USER -# TEST_REPORTER: jest-junit -# JEST_JUNIT_OUTPUT_DIR: /home/circleci/test-results/jest #circleci is the USER -# COVERAGE_DIR: /home/circleci/coverage #circleci is the USER - -# steps: -# - name: Install Chrome -# run: | -# apt-get update -# wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ -# && apt install -y /tmp/chrome.deb \ -# && rm /tmp/chrome.deb -# - name: Checkout -# uses: actions/checkout@v3 - -# - name: Install Python-2 -# run: | -# sudo apt-get update -# sudo apt-get install -y python2 - -# - name: install_node_dependencies -# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" - -# - name: jest -# shell: bash -# run: | -# npm install --save-dev jest -# mkdir -p ./test-results/jest -# pushd client -# ../ci-bin/capture-log "node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4" - -# - name: store_test_results -# uses: actions/upload-artifact@v3 -# with: -# path: ./test-results - -# - name: store logs -# uses: actions/upload-artifact@v3 -# with: -# path: ./all_logs.log - - - -# caseflow_lint_job: -# # This job will run the security lint checker, change the value below to false if you wish to turn it off. -# if: true -# runs-on: ubuntu-latest -# container: -# image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers -# credentials: -# username: AWS -# password: ${{ secrets.ECR_PASSWORD }} - -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# with: -# fetch-depth: '0' - -# - name: Install Ruby Dependencies -# run: | -# ruby -v -# BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ") -# echo $BUNDLER_V -# gem install bundler:$BUNDLER_V -# bundle install --path vendor/bundle -# - name: Install Node Dependencies -# run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" - -# # - name: Danger -# # run: ./ci-bin/capture-log "bundle exec danger" -# # env: -# # DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} - -# - name: Lint -# run: ./ci-bin/capture-log "bundle exec rake lint" -# if: ${{ always() }} - -# # - name: Security -# # run: ./ci-bin/capture-log "bundle exec rake security" -# # if: ${{ always() }} - +name: RSpec Jest Lint Workflow + +on: + workflow_dispatch: + pull_request: + types: [opened, reopened, synchronize] + +# Use this flag to turn on/off RSpec. Please go to the lint & js_test job to disable the boolean +env: + rspec_active: true + FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + # This job runs the main deployment of caseflow + caseflow_rspec_job: + runs-on: ubuntu-8-cores-latest + timeout-minutes: 45 + services: + postgres: + image: postgres:14.8 + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: password + POSTGRES_DB: caseflow_certification_test + + ports: + - 5432:5432 + + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + redis: + image: redis:4.0.10 + ports: + - 6379:6379 + + facols_db: + image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/facols:latest + credentials: + username: AWS + password: ${{ secrets.ECR_PASSWORD }} + ports: + - 1521:1521 + + strategy: + fail-fast: false + matrix: + ci_node_total: [12] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + + container: + image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers + options: --privileged # Necessary for Rspec to run with our configuration within GHA + credentials: + username: AWS + password: ${{ secrets.ECR_PASSWORD }} + + env: + DBUS_SESSION_BUS_ADDRESS: /dev/null + RAILS_ENV: test + NODE_ENV: test + BUNDLE_PATH: vendor/bundle + COVERAGE_DIR: /home/circleci/coverage-${{matrix.ci_node_index}} #circleci is the USER + POSTGRES_HOST: postgres + POSTGRES_USER: root + POSTGRES_PASSWORD: password + KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + WD_INSTALL_DIR: .webdrivers + CI: true + REDIS_URL_CACHE: redis://redis:6379/0/cache/ + TEST_VACOLS_HOST: facols_db + + steps: + - uses: actions/checkout@v3 + + # If we don't explicitly set this, the runner doesn't find the path when trying to save the cache + - name: Set yarn cache directory + id: set-yarn-cache-dir + run: mkdir -p ~/.cache/yarn && yarn config set cache-folder ~/.cache/yarn + + - name: restore yarn cache + id: cache-yarn-cache + uses: actions/cache/restore@v3 + with: + # hashFiles('client/yarn.lock') will use a unique cache based on dependencies so that we don't + # create a cache for each target branch + key: yarn-cache-${{ hashFiles('client/yarn.lock') }} + # We are including node_modules because most of the time is used to build the dependencies + path: | + node_modules + client/node_modules + ~/.cache/yarn + restore-keys: yarn-cache-${{ hashFiles('client/yarn.lock') }} + + # We run yarn install after loading the cache to update any dependencies if their version is different + - name: Install Node Dependencies + run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile --prefer-offline" + + - name: Save Yarn Cache + if: steps.cache-yarn-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + key: yarn-cache-${{ hashFiles('client/yarn.lock') }} + path: | + node_modules + client/node_modules + ~/.cache/yarn + + - name: setup testfiles directory + run: ./ci-bin/capture-log "mkdir -p tmp/testfiles" + + - name: Install Chrome + run: | + apt-get update + wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ + && apt install -y /tmp/chrome.deb \ + && rm /tmp/chrome.deb + echo "Chrome exe name: $(ls /usr/bin | chrome)" + echo "Chrome version: $(google-chrome --version)" + + # wkhtmltopdf is a required library for certain rspec tests to pass + - name: Restore wkhtmltopdf + id: cache-wkhtmltopdf + uses: actions/cache/restore@v3 + with: + key: ${{ runner.os }}-wkhtmltopdf + path: wkhtmltox_0.12.6-1.focal_amd64.deb + + - name: Download wkhtmltopdf + if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' + run: wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb + + - name: Install wkhtmltopdf + run: apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb + + - name: Cache wkhtmltopdf + if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + key: ${{ runner.os }}-wkhtmltopdf + path: wkhtmltox_0.12.6-1.focal_amd64.deb + + - name: Restore Ruby Dependencies + id: cache-ruby-dependencies + uses: actions/cache/restore@v3 + with: + key: bundler-gems + path: vendor/bundle + restore-keys: bundler-gems + + - name: Install/Update Ruby Dependencies + run: | + ruby -v + BASH_ENV="Bash" + echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> "$BASH_ENV" + export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") + gem install bundler + bundle install --path vendor/bundle + + - name: Cache Ruby Dependencies + if: steps.cache-ruby-dependencies.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + key: bundler-gems + path: vendor/bundle + + - name: Install Dockerize + run: | + DOCKERIZE_VERSION="v0.6.1" + wget https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ + && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ + && rm dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz + + - name: "Wait for database" + run: dockerize -wait tcp://postgres:5432 -timeout 1m + + - name: "Wait for FACOLS" + run: ./ci-bin/capture-log "bundle exec rake local:vacols:wait_for_connection" + + - name: Database setup + run: | + ./ci-bin/capture-log "DB=etl bundle exec rake db:create db:schema:load db:migrate" + ./ci-bin/capture-log "bundle exec rake db:create db:schema:load db:migrate" + ./ci-bin/capture-log "make -f Makefile.example external-db-create" + # added line to create external table(s) that are needed for tests + + # We don't want to seed DBs here because DatabaseCleaner just truncates it anyway. The setup_vacols + # rake task needs to be run because it adds data to two tables that are ignored by DBCleaner + - name: Seed databases + run: | + ./ci-bin/capture-log "bundle exec rake spec:setup_vacols" + + - name: Assets Precompile + run: | + ./ci-bin/capture-log "bundle exec rake assets:precompile" + + # Changing the user and permissions as Chrome/Chromedriver can't run as root + - name: RSpec via knapsack_pro Queue Mode + run: | + mkdir -p ./test-results/rspec + mkdir .webdrivers + touch log/selenium-chrome.log + chmod -R 777 ${GITHUB_WORKSPACE} + export GHA_NODE_INDEX=${{matrix.ci_node_index}} + runuser -u circleci bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RSpec::Github::Formatter --tty]" + # --format RSpec::Github::Formatter use in Rspec-github gem, adds more detailed info to GHA "Annotations" + # --tty forces Rspec to produce color + # circleci is the USER + + # Artifacts --- circleci is the USER + - run: (cd /home/circleci && tar -zcvf coverage-${{matrix.ci_node_index}}.tar.gz coverage-${{matrix.ci_node_index}}) + - uses: actions/upload-artifact@v3 + if: success() + with: + path: /home/circleci/coverage-${{matrix.ci_node_index}}.tar.gz #circleci is the USER + + - uses: actions/upload-artifact@v3 + # Run even if there is a failure in the previous steps, but not if the run is cancelled + if: success() || failure() + name: capybara-artifacts + with: + path: ./tmp/capybara + + - name: Compress test logs + if: failure() + run: tar -czvf ./log/test-${{matrix.ci_node_index}}.log.tar.gz ./log/test.log + - uses: actions/upload-artifact@v3 + if: failure() + name: Upload test logs if failure + with: + path: ./log/test-${{matrix.ci_node_index}}.log.tar.gz + + - run: cp ./log/bullet.log ./log/bullet-${{matrix.ci_node_index}}.log + - uses: actions/upload-artifact@v3 + if: success() || failure() + name: bullet-${{matrix.ci_node_index}}.log + with: + path: ./log/bullet-${{matrix.ci_node_index}}.log + + caseflow_jest_job: + # This job will run the jest, change the value below to false if you wish to turn it off. + if: true + runs-on: ubuntu-latest + container: + image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers + credentials: + username: AWS + password: ${{ secrets.ECR_PASSWORD }} + env: + DBUS_SESSION_BUS_ADDRESS: /dev/null + RAILS_ENV: test + NODE_ENV: test + JEST_DIR: /home/circleci/test-results/jest #circleci is the USER + TEST_REPORTER: jest-junit + JEST_JUNIT_OUTPUT_DIR: /home/circleci/test-results/jest #circleci is the USER + COVERAGE_DIR: /home/circleci/coverage #circleci is the USER + + steps: + - name: Install Chrome + run: | + apt-get update + wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ + && apt install -y /tmp/chrome.deb \ + && rm /tmp/chrome.deb + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Python-2 + run: | + sudo apt-get update + sudo apt-get install -y python2 + + - name: install_node_dependencies + run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" + + - name: jest + shell: bash + run: | + npm install --save-dev jest + mkdir -p ./test-results/jest + pushd client + ../ci-bin/capture-log "node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4" + + - name: store_test_results + uses: actions/upload-artifact@v3 + with: + path: ./test-results + + - name: store logs + uses: actions/upload-artifact@v3 + with: + path: ./all_logs.log + + caseflow_lint_job: + # This job will run the security lint checker, change the value below to false if you wish to turn it off. + if: true + runs-on: ubuntu-latest + container: + image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers + credentials: + username: AWS + password: ${{ secrets.ECR_PASSWORD }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: "0" + + - name: Install Ruby Dependencies + run: | + ruby -v + BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ") + echo $BUNDLER_V + gem install bundler:$BUNDLER_V + bundle install --path vendor/bundle + - name: Install Node Dependencies + run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" + + # - name: Danger + # run: ./ci-bin/capture-log "bundle exec danger" + # env: + # DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} + + - name: Lint + run: ./ci-bin/capture-log "bundle exec rake lint" + if: ${{ always() }} + + # - name: Security + # run: ./ci-bin/capture-log "bundle exec rake security" + # if: ${{ always() }} From 55ff1464a005f7827c7b43f181f42c7a7c89fd4e Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Fri, 29 Dec 2023 09:05:41 -0500 Subject: [PATCH 10/16] Fix deprecation warnings --- .github/workflows/make-docs.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 09ea2fcfb3b..e3b7617e498 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -2,8 +2,9 @@ name: Make-docs-to-webpage # Trigger running when a PR is closed on: + workflow_dispatch: pull_request: - types: [ closed ] + types: [ closed, opened, reopened, synchronize ] jobs: make_docs: @@ -39,7 +40,7 @@ jobs: env - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Since installing a client to Oracle DB is a pain and setting up the VACOLS DB is not necessary, let's skip it. - name: Remove references to VACOLS Oracle DB @@ -148,13 +149,13 @@ jobs: git add . if git diff-index --quiet HEAD; then - echo "::set-output name=changes_docs::false" + echo "name=changes_docs::false" >> $GITHUB_OUTPUT echo "::group::No changes to make_docs" ls -alR schema/make_docs echo "::endgroup::" else - echo "::set-output name=changes_docs::true" + echo "name=changes_docs::true" >> $GITHUB_OUTPUT echo "::group::Committing changes locally" git config --local user.email "$WIKI_COMMIT_USER_EMAIL" From 2214bcd1464ca44ff74295f94eeee6981416a401 Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Fri, 29 Dec 2023 09:08:34 -0500 Subject: [PATCH 11/16] Fix deprecation I missed --- .github/workflows/make-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index e3b7617e498..e4bbfe86a8e 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -120,7 +120,7 @@ jobs: # and https://github.com/Andrew-Chen-Wang/github-wiki-action/blob/master/entrypoint.sh # and https://github.community/t/how-to-updade-repo-wiki-from-github-actions/121151/7 - name: Checkout branch main-gh-pages - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: main-gh-pages path: main-gh-pages_checkout From 7d1f29c99a379e1791656cd1c8c90a78b29d912d Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Fri, 29 Dec 2023 09:48:51 -0500 Subject: [PATCH 12/16] Reintroduce conditional to make-docs workflow --- .github/workflows/make-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index e4bbfe86a8e..303668091fe 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -4,13 +4,13 @@ name: Make-docs-to-webpage on: workflow_dispatch: pull_request: - types: [ closed, opened, reopened, synchronize ] + types: [ closed ] jobs: make_docs: name: Update DB schema files in webpage # Only run if the PR has been merged (rather than simply closed) - # if: github.event.pull_request.merged == true + if: github.event.pull_request.merged == true runs-on: ubuntu-latest services: postgres: From b9efccf8bb06cf890a0e24542d4d92d23c93532f Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Fri, 29 Dec 2023 10:08:08 -0500 Subject: [PATCH 13/16] Remove workflow dispatch --- .github/workflows/make-docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index 303668091fe..aca7b594645 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -2,7 +2,6 @@ name: Make-docs-to-webpage # Trigger running when a PR is closed on: - workflow_dispatch: pull_request: types: [ closed ] From c1228140e968c118ca591b119287260d94444f3a Mon Sep 17 00:00:00 2001 From: AimanK Date: Fri, 29 Dec 2023 12:27:55 -0500 Subject: [PATCH 14/16] Attempt to fix test --- client/app/queue/utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/app/queue/utils.js b/client/app/queue/utils.js index fa47501515f..46e449be2aa 100644 --- a/client/app/queue/utils.js +++ b/client/app/queue/utils.js @@ -564,9 +564,18 @@ export const prepareAppealForSearchStore = (appeals) => { issues: prepareAppealIssuesForStore(appeal), decisionIssues: appeal.attributes.decision_issues, appellantFullName: appeal.attributes.appellant_full_name, + appellantFirstName: appeal.attributes.appellant_first_name, + appellantMiddleName: appeal.attributes.appellant_middle_name, + appellantLastName: appeal.attributes.appellant_last_name, + appellantSuffix: appeal.attributes.appellant_suffix, + appellantDateOfBirth: appeal.attributes.appellant_date_of_birth, + appellantAddress: appeal.attributes.appellant_address, + appellantEmailAddress: appeal.attributes.appellant_email_address, appellantPhoneNumber: appeal.attributes.appellant_phone_number, contestedClaim: appeal.attributes.contested_claim, assignedToLocation: appeal.attributes.assigned_to_location, + veteranGender: appeal.attributes.veteran_gender, + veteranAddress: appeal.attributes.veteran_address, veteranParticipantId: appeal.attributes.veteran_participant_id, externalId: appeal.attributes.external_id, status: appeal.attributes.status, From 682b614616859fd9551a2902a71c3158038d00cd Mon Sep 17 00:00:00 2001 From: Matthew Thornton Date: Tue, 2 Jan 2024 09:45:41 -0500 Subject: [PATCH 15/16] Alter trigger --- .github/workflows/make-docs.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/make-docs.yml b/.github/workflows/make-docs.yml index aca7b594645..8e5bc45141a 100644 --- a/.github/workflows/make-docs.yml +++ b/.github/workflows/make-docs.yml @@ -1,9 +1,10 @@ name: Make-docs-to-webpage -# Trigger running when a PR is closed +# Trigger whenever changes are made to the master branch on: - pull_request: - types: [ closed ] + push: + branches: + - master jobs: make_docs: From de39b2ec437646160773c76534609d8d10789545 Mon Sep 17 00:00:00 2001 From: AimanK Date: Tue, 2 Jan 2024 13:55:22 -0500 Subject: [PATCH 16/16] Attempt to fix failing RSpec test --- .../work_queue/appeal_search_serializer.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/models/serializers/work_queue/appeal_search_serializer.rb b/app/models/serializers/work_queue/appeal_search_serializer.rb index cdce3ff7be9..5ad6d15204d 100644 --- a/app/models/serializers/work_queue/appeal_search_serializer.rb +++ b/app/models/serializers/work_queue/appeal_search_serializer.rb @@ -72,10 +72,38 @@ class WorkQueue::AppealSearchSerializer object.claimant&.name end + attribute :appellant_first_name do |object| + object.claimant&.first_name + end + + attribute :appellant_middle_name do |object| + object.claimant&.middle_name + end + + attribute :appellant_last_name do |object| + object.claimant&.last_name + end + + attribute :appellant_suffix do |object| + object.claimant&.suffix + end + + attribute :appellant_date_of_birth do |object| + object.claimant&.date_of_birth + end + + attribute :appellant_address do |object| + object.claimant&.address + end + attribute :appellant_phone_number do |object| object.claimant&.unrecognized_claimant? ? object.claimant&.phone_number : nil end + attribute :appellant_email_address do |object| + object.claimant&.email_address + end + attribute :veteran_death_date attribute :veteran_file_number