|  | 
|  | 1 | + | 
|  | 2 | +# This is a basic workflow to help you get started with Actions | 
|  | 3 | + | 
|  | 4 | +name: Playwright tests | 
|  | 5 | + | 
|  | 6 | +# Controls when the workflow will run | 
|  | 7 | +on: | 
|  | 8 | + # Triggers the workflow on push or pull request events but only for the "main" branch | 
|  | 9 | + push: | 
|  | 10 | + branches: [ "main" ] | 
|  | 11 | + pull_request: | 
|  | 12 | + branches: [ "main" ] | 
|  | 13 | + schedule:  | 
|  | 14 | + # nightly | 
|  | 15 | + - cron: '0 0 * * *' | 
|  | 16 | +  | 
|  | 17 | + # Allows you to run this workflow manually from the Actions tab | 
|  | 18 | + workflow_dispatch: | 
|  | 19 | + | 
|  | 20 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel | 
|  | 21 | +jobs: | 
|  | 22 | + test: | 
|  | 23 | + # Runs on an ubuntu runner | 
|  | 24 | + runs-on: ubuntu-latest | 
|  | 25 | + | 
|  | 26 | + strategy: | 
|  | 27 | + matrix: | 
|  | 28 | + node-version: [14.x, 16.x, 18.x] | 
|  | 29 | + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | 
|  | 30 | + | 
|  | 31 | + steps: | 
|  | 32 | + - uses: actions/checkout@v3 | 
|  | 33 | + - uses: actions/setup-node@v3 | 
|  | 34 | + - name: Install dependencies | 
|  | 35 | + run: npm ci | 
|  | 36 | + - name: Install Playwright | 
|  | 37 | + run: npx playwright install --with-deps | 
|  | 38 | + - name: Build production build | 
|  | 39 | + run: npm run build | 
|  | 40 | + - name: Run your tests | 
|  | 41 | + run: npm run playwright_test | 
|  | 42 | + - name: Get current date | 
|  | 43 | + id: date | 
|  | 44 | + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | 
|  | 45 | + - name: Upload HTML report as Artifact | 
|  | 46 | + uses: actions/upload-artifact@v2 | 
|  | 47 | + env: | 
|  | 48 | + TAG_NAME: test-report-${{ steps.date.outputs.date }} | 
|  | 49 | + if: always() | 
|  | 50 | + with:  | 
|  | 51 | + name: onDemand | 
|  | 52 | + path: pw-report/ | 
|  | 53 | + | 
|  | 54 | + storeReports: | 
|  | 55 | + name: Store reports | 
|  | 56 | + if: ${{ always() }} | 
|  | 57 | + needs: test | 
|  | 58 | + runs-on: ubuntu-latest | 
|  | 59 | + steps: | 
|  | 60 | + - name: Download all workflow run artifacts | 
|  | 61 | + uses: actions/download-artifact@v3 | 
|  | 62 | + id: download | 
|  | 63 | + - name: Publish to external repo | 
|  | 64 | + if: always() | 
|  | 65 | + uses: peaceiris/actions-gh-pages@v3.7.3 | 
|  | 66 | + with: | 
|  | 67 | + external_repository: mspnp/intern-js-pipeline | 
|  | 68 | + publish_branch: gh-pages | 
|  | 69 | + personal_token: ${{ secrets.PAT_TOKEN }} | 
|  | 70 | + publish_dir: ${{steps.download.outputs.download-path}} | 
|  | 71 | + destination_dir: test-reports/${{ github.repository }} | 
|  | 72 | + keep_files: true | 
|  | 73 | + user_name: "github-actions[bot]" | 
|  | 74 | + user_email: "github-actions[bot]@users.noreply.github.com" | 
|  | 75 | + | 
|  | 76 | + notify-dashboard: | 
|  | 77 | + name: Notify Dashboard | 
|  | 78 | + if: ${{ always() }} | 
|  | 79 | + needs: [test, storeReports] | 
|  | 80 | + # The type of runner that the job will run on | 
|  | 81 | + runs-on: ubuntu-latest | 
|  | 82 | + | 
|  | 83 | + # Steps represent a sequence of tasks that will be executed as part of the job | 
|  | 84 | + steps: | 
|  | 85 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | 
|  | 86 | + - uses: actions/checkout@v3 | 
|  | 87 | + | 
|  | 88 | + # Runs a single command using the runners shell | 
|  | 89 | + - name: Notify docusaurus repo | 
|  | 90 | + env: | 
|  | 91 | + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | 
|  | 92 | + run: | | 
|  | 93 | + gh api repos/mspnp/intern-js-pipeline/dispatches \ | 
|  | 94 | + --raw-field event_type=rebuild-site | 
0 commit comments