Debug recent changes to Regression Testing Pipeline #1489
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yamllint disable | |
--- | |
name: Regression Testing | |
on: | |
push: | |
branches: | |
- develop | |
- integration | |
paths: | |
- frontend/** | |
- backend/** | |
- playwright/e2e/** | |
- integration/** | |
- .github/workflows/regression.yml | |
pull_request: | |
branches: | |
- develop | |
- integration | |
paths: | |
- frontend/** | |
- backend/** | |
- playwright/e2e/** | |
- integration/** | |
- .github/workflows/regression.yml | |
defaults: | |
run: | |
working-directory: ./playwright | |
jobs: | |
test_staging_frontend: | |
runs-on: ubuntu-latest | |
environment: staging | |
timeout-minutes: 60 | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop') | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_SUBNET: ${{ secrets.AWS_SUBNET }} | |
AWS_SECURITY_GROUP: ${{ secrets.AWS_SECURITY_GROUP }} | |
AUTOMATED_TEST_REPORTS_BUCKET_NAME: cisa-crossfeed-staging-cd-automated-test-reports | |
PW_XFD_URL: https://staging-cd.crossfeed.cyber.dhs.gov | |
PW_GLOBAL_ADMIN_USERNAME: ${{ secrets.PW_GLOBAL_ADMIN_USERNAME }} | |
PW_GLOBAL_ADMIN_PASSWORD: ${{ secrets.PW_GLOBAL_ADMIN_PASSWORD }} | |
PW_GLOBAL_ADMIN_2FA_SECRET: ${{ secrets.PW_GLOBAL_ADMIN_2FA_SECRET }} | |
PW_REGIONAL_ADMIN_USERNAME: ${{ secrets.PW_REGIONAL_ADMIN_USERNAME }} | |
PW_REGIONAL_ADMIN_PASSWORD: ${{ secrets.PW_REGIONAL_ADMIN_PASSWORD }} | |
PW_REGIONAL_ADMIN_2FA_SECRET: ${{ secrets.PW_REGIONAL_ADMIN_2FA_SECRET }} | |
PW_GLOBAL_VIEW_USERNAME: ${{ secrets.PW_GLOBAL_VIEW_USERNAME }} | |
PW_GLOBAL_VIEW_PASSWORD: ${{ secrets.PW_GLOBAL_VIEW_PASSWORD }} | |
PW_GLOBAL_VIEW_2FA_SECRET: ${{ secrets.PW_GLOBAL_VIEW_2FA_SECRET }} | |
PW_STANDARD_USER_USERNAME: ${{ secrets.PW_STANDARD_USER_USERNAME }} | |
PW_STANDARD_USER_PASSWORD: ${{ secrets.PW_STANDARD_USER_PASSWORD }} | |
PW_STANDARD_USER_2FA_SECRET: ${{ secrets.PW_STANDARD_USER_2FA_SECRET }} | |
PW_XFD_2FA_ISSUER: ${{ secrets.PW_XFD_2FA_ISSUER }} | |
PW_HEADLESS: true | |
CI: true | |
ENVIRONMENT: staging | |
GIT_BRANCH: JD_CRASM-3218_Debug_Regression_Testing_Pipeline | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Set environment variables for staging | |
run: echo "ENVIRONMENT=staging" >> $GITHUB_ENV | |
- name: Run Playwright tests | |
id: run_tests | |
run: | | |
chmod +x run_playwright_tests.sh | |
CLUSTER_NAME=crossfeed-playwright-staging-cd-ecs-cluster \ | |
TASK_DEFINITION=crossfeed-staging-cd-playwright-worker \ | |
./run_playwright_tests.sh | |
continue-on-error: true | |
- name: Download test report from S3 | |
run: | | |
mkdir -p ./playwright-report/html | |
aws s3 cp \ | |
"s3://$AUTOMATED_TEST_REPORTS_BUCKET_NAME/staging/playwright-reports/latest/html/" \ | |
playwright-report/html/ --recursive | |
aws s3 cp \ | |
"s3://$AUTOMATED_TEST_REPORTS_BUCKET_NAME/staging/playwright-reports/latest/results.json" \ | |
playwright-report/results.json | |
- name: Upload Playwright HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-html-report-staging | |
path: playwright/playwright-report/html/ | |
- name: Upload Playwright results JSON | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-results-json | |
path: playwright/playwright-report/results.json | |
- name: Fail job if tests failed | |
if: steps.run_tests.outcome != 'success' | |
run: exit 1 | |
test_staging_api: | |
runs-on: ubuntu-latest | |
environment: staging | |
timeout-minutes: 20 | |
if: false # TODO: Temporarily skip while issues with API testing are resolved. | |
defaults: | |
run: | |
working-directory: ./integration | |
env: | |
BACKEND_DOMAIN: https://api.staging-cd.crossfeed.cyber.dhs.gov | |
X_API_KEY: ${{ secrets.X_API_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run Pytest with HTML and JSON reports | |
id: run_tests | |
run: | | |
mkdir -p test-reports | |
pytest -m integration \ | |
--tb=short \ | |
--maxfail=5 \ | |
--capture=tee-sys \ | |
--html=test-reports/report.html \ | |
--self-contained-html \ | |
--json-report \ | |
--json-report-file=test-reports/report.json | |
continue-on-error: true | |
- name: Upload Pytest HTML Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-html-report | |
path: integration/test-reports/report.html | |
- name: Upload Pytest JSON Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-json-report | |
path: integration/test-reports/report.json | |
- name: Fail job if tests failed | |
if: steps.run_tests.outcome != 'success' | |
run: exit 1 | |
test_integration: | |
runs-on: ubuntu-latest | |
environment: integration | |
timeout-minutes: 60 | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/integration') || (github.event_name == 'pull_request' && github.base_ref == 'integration') | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_SUBNET: ${{ secrets.AWS_SUBNET }} | |
AWS_SECURITY_GROUP: ${{ secrets.AWS_SECURITY_GROUP }} | |
AUTOMATED_TEST_REPORTS_BUCKET_NAME: cisa-crossfeed-integration-automated-test-reports | |
PW_XFD_URL: https://integration.crossfeed.cyber.dhs.gov | |
PW_GLOBAL_ADMIN_USERNAME: ${{ secrets.PW_GLOBAL_ADMIN_USERNAME }} | |
PW_GLOBAL_ADMIN_PASSWORD: ${{ secrets.PW_GLOBAL_ADMIN_PASSWORD }} | |
PW_GLOBAL_ADMIN_2FA_SECRET: ${{ secrets.PW_GLOBAL_ADMIN_2FA_SECRET }} | |
PW_REGIONAL_ADMIN_USERNAME: ${{ secrets.PW_REGIONAL_ADMIN_USERNAME }} | |
PW_REGIONAL_ADMIN_PASSWORD: ${{ secrets.PW_REGIONAL_ADMIN_PASSWORD }} | |
PW_REGIONAL_ADMIN_2FA_SECRET: ${{ secrets.PW_REGIONAL_ADMIN_2FA_SECRET }} | |
PW_GLOBAL_VIEW_USERNAME: ${{ secrets.PW_GLOBAL_VIEW_USERNAME }} | |
PW_GLOBAL_VIEW_PASSWORD: ${{ secrets.PW_GLOBAL_VIEW_PASSWORD }} | |
PW_GLOBAL_VIEW_2FA_SECRET: ${{ secrets.PW_GLOBAL_VIEW_2FA_SECRET }} | |
PW_STANDARD_USER_USERNAME: ${{ secrets.PW_STANDARD_USER_USERNAME }} | |
PW_STANDARD_USER_PASSWORD: ${{ secrets.PW_STANDARD_USER_PASSWORD }} | |
PW_STANDARD_USER_2FA_SECRET: ${{ secrets.PW_STANDARD_USER_2FA_SECRET }} | |
PW_XFD_2FA_ISSUER: ${{ secrets.PW_XFD_2FA_ISSUER }} | |
PW_HEADLESS: true | |
CI: true | |
ENVIRONMENT: integration | |
GIT_BRANCH: integration | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set environment variables for integration | |
run: echo "ENVIRONMENT=integration" >> $GITHUB_ENV | |
- name: Run Playwright tests | |
working-directory: ./playwright | |
id: run_tests | |
run: | | |
chmod +x run_playwright_tests.sh | |
CLUSTER_NAME=crossfeed-playwright-integration-ecs-cluster \ | |
TASK_DEFINITION=crossfeed-integration-playwright-worker \ | |
./run_playwright_tests.sh | |
continue-on-error: true | |
- name: Download test report from S3 | |
run: | | |
mkdir -p ./playwright-report/html | |
aws s3 cp \ | |
"s3://${AUTOMATED_TEST_REPORTS_BUCKET_NAME}/integration/playwright-reports/html/" \ | |
./playwright-report/html/ --recursive | |
aws s3 cp \ | |
"s3://$AUTOMATED_TEST_REPORTS_BUCKET_NAME/integration/playwright-reports/latest/results.json" \ | |
./playwright-report/results.json | |
- name: Upload Playwright HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-html-report-integration | |
path: playwright/playwright-report/html/ | |
- name: Upload Playwright results JSON | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-results-json | |
path: playwright/playwright-report/results.json | |
- name: Fail job if tests failed | |
if: steps.run_tests.outcome != 'success' | |
run: exit 1 | |
test_integration_api: | |
runs-on: ubuntu-latest | |
environment: integration | |
timeout-minutes: 20 | |
if: false # TODO: Temporarily skip while issues with API testing are resolved. | |
defaults: | |
run: | |
working-directory: ./integration | |
env: | |
BACKEND_DOMAIN: https://api.integration.crossfeed.cyber.dhs.gov | |
X_API_KEY: ${{ secrets.X_API_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run Pytest with HTML and JSON reports | |
id: run_tests | |
run: | | |
mkdir -p test-reports | |
pytest -m integration \ | |
--tb=short \ | |
--maxfail=5 \ | |
--capture=tee-sys \ | |
--html=test-reports/report.html \ | |
--self-contained-html \ | |
--json-report \ | |
--json-report-file=test-reports/report.json | |
continue-on-error: true | |
- name: Upload Pytest HTML Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-html-report | |
path: integration/test-reports/report.html | |
- name: Upload Pytest JSON Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-json-report | |
path: integration/test-reports/report.json | |
- name: Fail job if tests failed | |
if: steps.run_tests.outcome != 'success' | |
run: exit 1 |