|
1 | | -name: Visual Regression Tests |
| 1 | +name: Accessibility and Visual Regression Tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - issue_comment: |
5 | | - types: |
6 | | - - created |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - next |
| 8 | + paths: |
| 9 | + - 'polaris-react/src/**' |
| 10 | + - 'polaris-react/playground/**' |
| 11 | + - 'polaris-tokens/src/**' |
| 12 | + pull_request: |
| 13 | + paths: |
| 14 | + - 'polaris-react/src/**' |
| 15 | + - 'polaris-react/playground/**' |
| 16 | + - 'polaris-tokens/src/**' |
7 | 17 |
|
8 | 18 | jobs: |
9 | | - visual_regression_test: |
10 | | - name: 'Visual regression test' |
11 | | - if: | |
12 | | - github.event.issue.pull_request && github.event.comment.body == '/vistest' |
| 19 | + accessibility_test: |
| 20 | + name: 'Accessibility test' |
13 | 21 | runs-on: ubuntu-latest |
14 | 22 | steps: |
15 | | - - name: Enforce permission requirement |
16 | | - uses: prince-chrismc/check-actor-permissions-action@v1 |
| 23 | + - name: Checkout branch |
| 24 | + uses: actions/checkout@v3 |
| 25 | + |
| 26 | + - name: Setup Node with v16.13.0 |
| 27 | + uses: actions/setup-node@v3 |
17 | 28 | with: |
18 | | - permission: write |
| 29 | + node-version: 16.13.0 |
| 30 | + cache: yarn |
19 | 31 |
|
20 | | - - name: Validate pull request is not on forked repo |
21 | | - uses: actions/github-script@v6 |
22 | | - id: pr_data |
23 | | - env: |
24 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + - name: Restore cache |
| 33 | + uses: actions/cache@v3 |
25 | 34 | with: |
26 | | - script: | |
27 | | - try { |
28 | | - const pullRequest = await github.rest.pulls.get({ |
29 | | - owner: context.repo.owner, |
30 | | - repo: context.repo.repo, |
31 | | - pull_number: context.issue.number, |
32 | | - }) |
| 35 | + path: | |
| 36 | + **/.turbo |
| 37 | + node_modules/.cache/turbo |
| 38 | + polaris-react/build-internal/cache |
| 39 | + key: ${{ runner.os }}-accessibility-test-v1-${{ github.sha }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-accessibility-test-v1- |
33 | 42 |
|
34 | | - // Pull request from fork |
35 | | - if (context.payload.repository.full_name !== pullRequest.data.head.repo.full_name) { |
36 | | - const errorMessage = '`/vistest` is not supported on pull requests from forked repositories.' |
| 43 | + - name: Install dependencies |
| 44 | + run: yarn --frozen-lockfile |
| 45 | + |
| 46 | + - name: Build packages |
| 47 | + run: yarn turbo run build --filter=@shopify/polaris |
37 | 48 |
|
38 | | - await github.rest.issues.createComment({ |
39 | | - issue_number: context.issue.number, |
40 | | - owner: context.repo.owner, |
41 | | - repo: context.repo.repo, |
42 | | - body: errorMessage, |
43 | | - }) |
| 49 | + - name: Build Storybook |
| 50 | + run: yarn workspace @shopify/polaris run storybook:build --quiet |
44 | 51 |
|
45 | | - core.setFailed(errorMessage) |
46 | | - } |
47 | | - } catch (err) { |
48 | | - core.setFailed(`Request failed with error ${err}`) |
49 | | - } |
| 52 | + - name: Run accessibility test |
| 53 | + run: node ./polaris-react/scripts/accessibility-check.js |
| 54 | + env: |
| 55 | + STORYBOOK_DISABLE_DOCS: 1 |
50 | 56 |
|
| 57 | + visual_regression_test: |
| 58 | + name: 'Visual regression test' |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
51 | 61 | - name: Checkout branch |
52 | 62 | uses: actions/checkout@v3 |
53 | 63 | with: |
|
0 commit comments