Rename config to configuration in v3 schema and add v3 cleaner #1164
Workflow file for this run
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
| name: CI | |
| permissions: | |
| contents: read | |
| on: pull_request | |
| concurrency: | |
| group: ${{github.workflow_ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: Brightspace/third-party-actions@actions/checkout | |
| - name: Set up node | |
| uses: Brightspace/setup-node@main | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint (ESLint) | |
| run: npm run lint:eslint | |
| - name: Lint (EditorConfig) | |
| run: npm run lint:editorconfig | |
| licenses: | |
| name: Check Licenses | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: Brightspace/third-party-actions@actions/checkout | |
| - name: Set up node | |
| uses: Brightspace/setup-node@main | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check licenses | |
| run: npm run license-check | |
| test: | |
| name: Test | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: Brightspace/third-party-actions@actions/checkout | |
| - name: Set up node | |
| uses: Brightspace/setup-node@main | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - name: Install dependencies (npm) | |
| run: npm ci | |
| - name: Install dependencies (Playwright) | |
| run: npx playwright install --with-deps | |
| - name: Run tests | |
| id: tests | |
| run: npm run test:all | |
| - name: Generate coverage info | |
| if: > | |
| !cancelled() && github.actor != 'dependabot[bot]' && ( | |
| steps.tests.conclusion == 'failure' || | |
| steps.tests.outcome == 'success' | |
| ) | |
| id: coverage | |
| run: | | |
| SOURCE='./coverage/lcov-report/' | |
| if [ ! -f "$SOURCE/index.html" ]; then | |
| echo "No coverage report found." | |
| exit 1 | |
| fi | |
| COMMON_PATH="$GITHUB_REPOSITORY/$GITHUB_RUN_ID/$GITHUB_RUN_ATTEMPT/$GITHUB_JOB" | |
| DESTINATION="s3://test-reporting-coverage/$COMMON_PATH/" | |
| URL="https://test-reporting.d2l.dev/coverage/$COMMON_PATH/" | |
| echo "destination=$DESTINATION" >> $GITHUB_OUTPUT | |
| echo "source=$SOURCE" >> $GITHUB_OUTPUT | |
| echo "url=$URL" >> $GITHUB_OUTPUT | |
| - name: Assume role | |
| if: (!cancelled()) && steps.coverage.outputs.source != '' | |
| uses: Brightspace/third-party-actions@aws-actions/configure-aws-credentials | |
| with: | |
| aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}} | |
| aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
| aws-session-token: ${{secrets.AWS_SESSION_TOKEN}} | |
| aws-region: us-east-1 | |
| role-to-assume: arn:aws:iam::427469055187:role/github+Brightspace+test-reporting-node | |
| role-duration-seconds: 3600 | |
| - name: Upload coverage | |
| if: (!cancelled()) && steps.coverage.outputs.source != '' | |
| uses: BrightspaceUI/actions/publish-to-s3@main | |
| with: | |
| bucket-path: ${{steps.coverage.outputs.destination}} | |
| publish-directory: ${{steps.coverage.outputs.source}} | |
| - name: Report test results (Unit) | |
| if: (!cancelled()) && github.actor != 'dependabot[bot]' | |
| uses: Brightspace/test-reporting-action@main | |
| with: | |
| aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}} | |
| aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
| aws-session-token: ${{secrets.AWS_SESSION_TOKEN}} | |
| - name: Report test results (Validation) | |
| if: (!cancelled()) && github.actor != 'dependabot[bot]' | |
| uses: Brightspace/test-reporting-action@main | |
| with: | |
| aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}} | |
| aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
| aws-session-token: ${{secrets.AWS_SESSION_TOKEN}} | |
| report-path: ./d2l-test-report-validation.json | |
| - name: Generate test summary | |
| id: summary | |
| if: > | |
| !cancelled() && ( | |
| steps.tests.conclusion == 'failure' || | |
| steps.tests.outcome == 'success' | |
| ) | |
| uses: Brightspace/third-party-actions@actions/github-script | |
| with: | |
| script: | | |
| const { existsSync } = await import('node:fs'); | |
| const { env } = await import('node:process'); | |
| const { | |
| COVERAGE_REPORT_URL: coverageReportUrl, | |
| REPORT_VALIDATION_RESULTS: reportValidationResultsPath | |
| } = env; | |
| const { summary } = core; | |
| summary.clear(); | |
| summary.addHeading('Coverage Report', 3); | |
| if (coverageReportUrl) { | |
| summary.addLink('Report', coverageReportUrl); | |
| } else { | |
| summary.addRaw('No coverage report generated.', true); | |
| summary.addEOL(); | |
| } | |
| summary.addHeading('Report Validation', 3); | |
| if (existsSync(reportValidationResultsPath)) { | |
| const validationResults = require(reportValidationResultsPath); | |
| for (const [framework, result] of Object.entries(validationResults)) { | |
| const { path, exists, schema, contents } = result; | |
| const failed = !exists || !schema || !contents; | |
| const headerIcon = failed ? ':red_circle:' : ':green_circle:'; | |
| const header = `<code>${framework}</code> ${headerIcon}`; | |
| let body = '<br/>\n\n'; | |
| if (exists) { | |
| const schemaIcon = schema ? ':green_circle:' : ':red_circle:'; | |
| const contentsIcon = contents ? ':green_circle:' : ':red_circle:'; | |
| body += `Schema: ${schema ? '**PASSED**' : '**FAILED**'} ${schemaIcon}\n`; | |
| body += `Contents: ${contents ? '**PASSED**' : '**FAILED**'} ${contentsIcon}\n`; | |
| const reportContents = JSON.stringify(require(path), null, 2); | |
| body += `\n#### Report Contents\n\n`; | |
| body += `\`\`\`json\n${reportContents}\n\`\`\``; | |
| } else { | |
| body += 'No report generated :fire:'; | |
| } | |
| body += '\n\n'; | |
| summary.addDetails(header, body); | |
| } | |
| } else { | |
| summary.addRaw('No report validation results found :fire:', true); | |
| } | |
| summary.write({ overwrite: true }); | |
| core.setOutput('report', summary.stringify()); | |
| env: | |
| COVERAGE_REPORT_URL: ${{steps.coverage.outputs.url}} | |
| REPORT_VALIDATION_RESULTS: ./report-validation-results.json | |
| - name: Leave comment | |
| if: (!cancelled()) && steps.summary.outcome == 'success' | |
| uses: BrightspaceUI/actions/comment-on-pr@main | |
| with: | |
| message: ${{steps.summary.outputs.report}} | |
| post-mode: hide-previous |