Add workflow for plotly testing #10
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: "Plotly Test coverage" | |
on: | |
pull_request: | |
types: [synchronize] | |
workflow_dispatch: | |
inputs: | |
repo: | |
description: "Repo to run the tests on" | |
required: true | |
default: "microsoft/fluentui" | |
branch: | |
description: "Branch to run the tests on" | |
required: true | |
default: "master" | |
#Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
run_tests: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
runs-on: ${{matrix.os}} | |
outputs: | |
test_coverage: ${{steps.run_tests.outputs}} | |
windows_artifact_name: ${{ steps.windows.outputs.COVERAGE_FILENAME_WINDOWS}} | |
steps: | |
- name: Checkout [master] | |
uses: actions/checkout@v4 | |
- name: Checkout [react-charting] | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.inputs.repo || 'microsoft/fluentui'}} | |
ref: ${{ github.event.inputs.branch || 'master'}} | |
path: repo1 | |
- name: Show current directory | |
run: echo "$PWD" && ls | |
- name: Show repo1 respository | |
run: ls ./repo1 | |
- name: Set up node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install packgaes | |
run: yarn --cwd ./repo1 && yarn --cwd ./repo1/packages/charts/react-charting | |
- name: Intall nx globally | |
run: yarn global add nx | |
- name: Build | |
run: yarn --cwd ./repo1 && yarn nx run react-charting:build | |
- name: Run yarn pack to create .tgz file | |
run: | | |
cd ./repo1/packages/charts/react-charting | |
yarn pack --filename react-charting.tgz | |
id: pack | |
- name: Install .tgz file in Plotly examples | |
run: | | |
cd apps/plotly_examples | |
rm -rf node_modules | |
yarn add ../rep1/packages/charts/react-charting/react-charting.tgz | |
yarn install | |
- name: Locally run the test app | |
run: | | |
cd apps/plotly_examples | |
npm start | |
- name: Run playwright test script | |
run: | | |
cd apps/plotly_examples | |
npx cross-env BASE_URL='http://localhost:3000/' npx playwright test | |
- name: Open Playwright report | |
run: | | |
npx playwright test --reporter=html --output=apps/plotly_examples/playwright-report/ | |
- name: Upload playwright report as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: apps/plotly_examples/playwright-report/ |