Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ We recommend running tests as well as trying your build of a package in a real p

- `yarn test` will run tests for all packages
- `yarn turbo run test --filter="[HEAD^1]"` will test any package that has changed in the last commit
- Run visual testing via adding the `/vistest` comment in a PR

You can test your changes in another project locally by creating a [snapshot release](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#snapshot-release).

Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/ci-a11y.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Accessibility Tests

on:
push:
branches:
- main
- next

jobs:
accessibility_test:
name: 'Accessibility test'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3

- name: Setup Node with v16.13.0
uses: actions/setup-node@v3
with:
node-version: 16.13.0
cache: yarn

- name: Restore cache
uses: actions/cache@v3
with:
path: |
**/.turbo
node_modules/.cache/turbo
polaris-react/build-internal/cache
key: ${{ runner.os }}-accessibility-test-v1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-accessibility-test-v1-

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build packages
run: yarn turbo run build --filter=@shopify/polaris

- name: Build Storybook
run: yarn workspace @shopify/polaris run storybook:build --quiet

- name: Run accessibility test
run: node ./polaris-react/scripts/accessibility-check.js
env:
STORYBOOK_DISABLE_DOCS: 1
76 changes: 35 additions & 41 deletions .github/workflows/ci-a11y-vrt.yml → .github/workflows/vistest.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
name: Accessibility and Visual Regression Tests
name: Visual Regression Tests

on:
push:
branches:
- main
- next
paths:
- 'polaris-react/src/**'
- 'polaris-react/playground/**'
- 'polaris-tokens/src/**'
pull_request:
paths:
- 'polaris-react/src/**'
- 'polaris-react/playground/**'
- 'polaris-tokens/src/**'
issue_comment:
types:
- created

jobs:
accessibility_test:
name: 'Accessibility test'
visual_regression_test:
name: 'Visual regression test'
if: |
github.event.issue.pull_request && github.event.comment.body == '/vistest'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
Expand All @@ -38,35 +30,37 @@ jobs:
node-version: 16.13.0
cache: yarn

- name: Add initial reaction
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ github.event.comment.id }}
reactions: '+1'

- name: Restore cache
uses: actions/cache@v3
with:
path: |
**/.turbo
node_modules/.cache/turbo
polaris-react/build-internal/cache
key: ${{ runner.os }}-accessibility-test-v1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-accessibility-test-v1-

- name: Install dependencies
run: yarn --frozen-lockfile
script: |
try {
const pullRequest = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
// Pull request from fork
if (context.payload.repository.full_name !== pullRequest.data.head.repo.full_name) {
const errorMessage = '`/vistest` is not supported on pull requests from forked repositories.'
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: errorMessage,
})
core.setFailed(errorMessage)
}
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}

- name: Build packages
run: yarn turbo run build --filter=@shopify/polaris

- name: Build Storybook
run: yarn workspace @shopify/polaris run storybook:build --quiet

- name: Run accessibility test
run: node ./polaris-react/scripts/accessibility-check.js
env:
STORYBOOK_DISABLE_DOCS: 1

visual_regression_test:
name: 'Visual regression test'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
Expand Down