department-of-veterans-affairs/vets-website

View on GitHub
.github/workflows/e2e-allow-list-cleanup.yml

Summary

Maintainability
Test Coverage
name: Test Stability Allow List Cleanup

on:
  schedule:
    - cron: '0 12 * * 1-5'

jobs:
  fetch-allow-lists:
    name: Fetch Test Stability Allow Lists
    runs-on: ubuntu-latest
    outputs:
      allow_list: ${{ steps.allow-list-output.outputs.list }}
      all_specs: ${{ steps.spec-list-output.outputs.specs }}

    steps:
      - name: Checkout
        uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

      - name: Install dependencies
        uses: ./.github/workflows/install
        timeout-minutes: 30
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: .cache/yarn
          path: |
            .cache/yarn
            node_modules

      - name: Configure AWS credentials
        uses: ./.github/workflows/configure-aws-credentials
        with:
          aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: us-gov-west-1

      - name: Get va-vsp-bot token
        uses: ./.github/workflows/inject-secrets
        with:
          ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
          env_variable_name: VA_VSP_BOT_GITHUB_TOKEN

      - name: Get list of existing specs in vets-website
        run: node script/github-actions/export-test-lists.js

      - name: Archive E2E spec list
        if: ${{ always() }}
        uses: ./.github/workflows/upload-artifact
        with:
          name: e2e-spec-list
          path: ./e2e_spec_list.json

      - name: Archive Unit Test spec list
        if: ${{ always() }}
        uses: ./.github/workflows/upload-artifact
        with:
          name: unit-test-spec-list
          path: ./unit_test_spec_list.json

      - name: Init Dashboard Data Repo
        # uses: department-of-veterans-affairs/platform-release-tools-actions/init-data-repo@main
        uses: ./.github/workflows/init-data-repo

      - name: Set Up BigQuery Creds
        uses: ./.github/workflows/configure-bigquery

      - name: Fetch E2E Test Stability Allow List
        run: yarn get-allow-list
        working-directory: qa-standards-dashboard-data
        env:
          TEST_TYPE: e2e

      - name: Fetch Unit Test Stability Allow List
        run: yarn get-allow-list
        working-directory: qa-standards-dashboard-data
        env:
          TEST_TYPE: unit_test

      - name: Archive E2E Test Stability Allow List
        if: ${{ always() }}
        uses: ./.github/workflows/upload-artifact
        with:
          name: e2e-allow-list
          path: qa-standards-dashboard-data/e2e_allow_list.json

      - name: Archive Unit Test Stability Allow List
        if: ${{ always() }}
        uses: ./.github/workflows/upload-artifact
        with:
          name: unit-test-allow-list
          path: qa-standards-dashboard-data/unit_test_allow_list.json

  clean-up-allow-list:
    name: Clean up E2E Test Stability Allow List
    runs-on: ubuntu-latest
    needs: [fetch-allow-lists]
    steps:
      - name: Checkout
        uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

      - name: Configure AWS credentials
        uses: ./.github/workflows/configure-aws-credentials
        with:
          aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: us-gov-west-1

      - name: Get va-vsp-bot token
        uses: ./.github/workflows/inject-secrets
        with:
          ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
          env_variable_name: VA_VSP_BOT_GITHUB_TOKEN

      - name: Set Up BigQuery Creds
        uses: ./.github/workflows/configure-bigquery

      - name: Init Dashboard Data Repo
        # uses: department-of-veterans-affairs/platform-release-tools-actions/init-data-repo@main
        uses: ./.github/workflows/init-data-repo

      - name: Download E2E Spec List
        uses: ./.github/workflows/download-artifact
        with:
          name: e2e-spec-list
          path: ./qa-standards-dashboard-data

      - name: Download Unit Test Spec List
        uses: ./.github/workflows/download-artifact
        with:
          name: unit-test-spec-list
          path: ./qa-standards-dashboard-data

      - name: Download E2E Test Stability Allow List
        uses: ./.github/workflows/download-artifact
        with:
          name: e2e-allow-list
          path: ./qa-standards-dashboard-data

      - name: Download Unit Test Stability Allow List
        uses: ./.github/workflows/download-artifact
        with:
          name: unit-test-allow-list
          path: ./qa-standards-dashboard-data

      - name: Run E2E Test Stability Allow List Cleanup
        run: yarn cleanup-allow-list
        working-directory: qa-standards-dashboard-data
        env:
          ALL_SPECS: ${{ needs.fetch-e2e-allow-list.outputs.all_specs }}
          TEST_TYPE: e2e

      - name: Run Unit Test Stability Allow List Cleanup
        run: yarn cleanup-allow-list
        working-directory: qa-standards-dashboard-data
        env:
          ALL_SPECS: ${{ needs.fetch-e2e-allow-list.outputs.all_specs }}
          TEST_TYPE: unit_test