chore: update component test and generate reports #2
Workflow file for this run
This file contains 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: Component Test Reporter | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
jobs: | ||
test_and_upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Run Tests and Generate Report | ||
run: | | ||
npm run test:ts -- component | ||
- name: Upload Report to S3 | ||
uses: jakejarvis/[email protected] | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
SRC: ./test_reports/ | ||
DEST: /integrations-test-reports/${{ github.run_number }}/ | ||
- name: Comment on PR with S3 Object URL | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const runNumber = process.env.GITHUB_RUN_NUMBER; | ||
const commentBody = `Test report for this run is available at: https://company.s3.amazonaws.com/integrations-test-reports/${runNumber}/test-report.html`; | ||
// Get the pull request number | ||
const prNumber = context.payload.pull_request.number; | ||
// Comment on the pull request | ||
await github.issues.createComment({ owner, repo, issue_number: prNumber, body: commentBody }); | ||