Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
at lambda-fork/main 199 lines 6.7 kB view raw
1name: Playwright Tests 2on: 3 push: 4 branches: [master] 5 pull_request: 6permissions: 7 contents: read 8jobs: 9 playwright-tests: 10 timeout-minutes: 60 11 runs-on: ubuntu-latest 12 strategy: 13 fail-fast: false 14 matrix: 15 shardIndex: [1, 2, 3, 4, 5] 16 shardTotal: [5] 17 steps: 18 - name: Remove all fonts 19 run: rm -rf /usr/share/fonts 20 21 - uses: actions/checkout@v6 22 23 - name: Install CJK fonts 24 uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # v1.5.3 25 with: 26 packages: fonts-ipafont-mincho 27 execute_install_scripts: true 28 29 - uses: ./.github/actions/setup 30 31 - name: Build 32 run: npm run build 33 34 - name: Cache playwright browsers 35 id: cache-playwright 36 uses: actions/cache@v4 37 with: 38 path: | 39 ~/.cache/ms-playwright 40 key: cache-playwright-${{ hashFiles('package-lock.json') }} # playwright version is included in package-lock, so this serves as a reasonable cache key 41 42 - if: ${{ steps.cache-playwright.outputs.cache-hit != 'true' }} 43 name: Install Playwright Browsers 44 run: npx playwright install chromium 45 46 - name: Grab latest dictionaries from dictionaries branch 47 uses: actions/checkout@v6 48 with: 49 repository: yomidevs/yomitan # so that this works on forks 50 ref: dictionaries 51 path: dictionaries 52 53 ### [PR] master-screenshots 54 55 - name: "[PR] Grab latest screenshots from master branch" 56 uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # pin@v2 57 continue-on-error: true 58 id: master-screenshots 59 with: 60 github_token: ${{ secrets.GITHUB_TOKEN }} 61 repo: yomidevs/yomitan # so that this works on forks 62 name: playwright-screenshots 63 branch: master 64 workflow: playwright.yml 65 workflow_conclusion: success 66 path: test/playwright/__screenshots__/ 67 if: github.event_name == 'pull_request' 68 69 - name: "[PR] Store steps.master-screenshots.outcome in a file" 70 run: echo ${{ steps.master-screenshots.outcome }} > ./master-screenshots-outcome 71 if: github.event_name == 'pull_request' 72 73 - name: "[PR] Upload master-screenshots-outcome" 74 uses: actions/upload-artifact@v6 75 with: 76 name: master-screenshots-outcome-${{ matrix.shardIndex }} 77 path: master-screenshots-outcome 78 if: github.event_name == 'pull_request' 79 80 ### actual tests 81 - name: "[PR] Run tests & compare against master" 82 id: playwright 83 run: | 84 npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} 2>&1 | tee ./playwright-output || true 85 continue-on-error: true 86 if: github.event_name == 'pull_request' && steps.master-screenshots.outcome != 'failure' 87 88 - name: "[Push] Run tests & save screenshots" 89 id: playwright-master 90 run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} -u 2>&1 | tee ./playwright-output 91 if: github.event_name == 'push' 92 93 - uses: actions/upload-artifact@v6 94 with: 95 name: playwright-screenshots-${{ matrix.shardIndex }} 96 path: test/playwright/__screenshots__/ 97 retention-days: 1 98 99 - name: Upload blob report to GitHub Actions Artifacts 100 if: ${{ !cancelled() }} 101 uses: actions/upload-artifact@v6 102 with: 103 name: blob-report-${{ matrix.shardIndex }} 104 path: blob-report 105 retention-days: 1 106 107 - uses: actions/upload-artifact@v6 108 with: 109 name: playwright-output-${{ matrix.shardIndex }} 110 path: playwright-output 111 retention-days: 1 112 113 playwright: 114 timeout-minutes: 60 115 runs-on: ubuntu-latest 116 # Merge reports after playwright-tests, even if some shards have failed 117 if: ${{ !cancelled() }} 118 needs: [playwright-tests] 119 steps: 120 - uses: actions/checkout@v6 121 - uses: ./.github/actions/setup 122 123 ### playwright-report 124 - name: Download blob reports from GitHub Actions Artifacts 125 uses: actions/download-artifact@v7 126 with: 127 path: all-blob-reports 128 pattern: blob-report-* 129 merge-multiple: true 130 131 - name: Merge into HTML Report 132 run: npx playwright merge-reports --reporter html ./all-blob-reports 133 134 - name: Merge into JSON Report 135 run: npx playwright merge-reports --reporter json ./all-blob-reports > playwright-results.json 136 137 - uses: actions/upload-artifact@v6 138 with: 139 name: playwright-report 140 path: playwright-report/ 141 142 - uses: actions/upload-artifact@v6 143 with: 144 name: playwright-results-json 145 path: playwright-results.json 146 147 ### playwright-screenshots 148 - name: Download & merge screenshots from GitHub Actions Artifacts 149 uses: actions/download-artifact@v7 150 with: 151 path: test/playwright/__screenshots__ 152 pattern: playwright-screenshots-* 153 merge-multiple: true 154 155 - uses: actions/upload-artifact@v6 156 with: 157 name: playwright-screenshots 158 path: test/playwright/__screenshots__/ 159 160 ### [PR] master-screenshots-outcome 161 - name: '[PR] Download master-screenshots-outcome files' 162 uses: actions/download-artifact@v7 163 with: 164 path: master-screenshots-outcomes 165 pattern: master-screenshots-outcome-* 166 merge-multiple: true 167 if: github.event_name == 'pull_request' 168 169 - name: '[PR] Calculate if any shard failed to download master screenshots' 170 run: | 171 if grep -q "failure" master-screenshots-outcomes/*; then 172 echo "failure" > master-screenshots-outcome 173 else 174 echo "success" > master-screenshots-outcome 175 fi 176 if: github.event_name == 'pull_request' 177 178 - name: '[PR] Upload master-screenshots-outcome' 179 uses: actions/upload-artifact@v6 180 with: 181 name: master-screenshots-outcome 182 path: master-screenshots-outcome 183 if: github.event_name == 'pull_request' 184 185 ### playwright-output 186 - name: Download playwright-output files 187 uses: actions/download-artifact@v7 188 with: 189 path: playwright-outputs 190 pattern: playwright-output-* 191 merge-multiple: true 192 193 - name: Merge playwright output files 194 run: cat playwright-outputs/* > playwright-output 195 196 - uses: actions/upload-artifact@v6 197 with: 198 name: playwright-output 199 path: playwright-output