2023-08-03 10:11:18 +00:00
|
|
|
name: 'UI tests'
|
|
|
|
|
|
|
|
on: push
|
|
|
|
|
|
|
|
jobs:
|
2023-08-03 10:34:21 +00:00
|
|
|
cache-dependencies:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Commit
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Cache yarn dependencies and cypress
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
|
|
|
- name: Install dependencies if cache invalid
|
|
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
|
|
run: yarn
|
|
|
|
|
2023-08-07 07:35:38 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: cache-dependencies
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '18.x'
|
|
|
|
- name: Restore yarn dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
|
|
|
- name: Build
|
|
|
|
run: yarn build
|
|
|
|
|
2023-08-03 10:11:18 +00:00
|
|
|
interaction-and-and-accessibility:
|
|
|
|
runs-on: ubuntu-latest
|
2023-08-03 10:34:21 +00:00
|
|
|
needs: cache-dependencies
|
2023-08-03 10:11:18 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '18.x'
|
2023-08-03 10:34:21 +00:00
|
|
|
- name: Restore yarn dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
2023-08-03 10:11:18 +00:00
|
|
|
- name: Install Playwright
|
|
|
|
run: npx playwright install --with-deps
|
|
|
|
- name: Build Storybook
|
|
|
|
run: yarn build-storybook --quiet
|
2023-08-21 11:18:43 +00:00
|
|
|
- name: Run Storybook tests
|
2023-08-03 10:11:18 +00:00
|
|
|
run: |
|
|
|
|
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
|
|
|
|
"npx http-server storybook-static --port 6006 --silent" \
|
2023-08-03 10:53:16 +00:00
|
|
|
"npx wait-on tcp:127.0.0.1:6006 && yarn test-storybook"
|
2023-08-23 16:01:25 +00:00
|
|
|
|
|
|
|
deployment:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: cache-dependencies
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '18.x'
|
2023-08-23 18:16:57 +00:00
|
|
|
- uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: console.log(context)
|
2023-08-23 16:01:25 +00:00
|
|
|
- name: Restore yarn dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
|
|
|
- name: Pull Vercel configuration
|
2023-08-23 17:12:31 +00:00
|
|
|
run: yarn vercel pull --yes --token ${{ secrets.vercel_token }}
|
2023-08-23 16:01:25 +00:00
|
|
|
- name: Build Vercel bundle
|
|
|
|
run: yarn vercel build
|
|
|
|
- name: Deploy to Vercel
|
2023-08-23 17:12:31 +00:00
|
|
|
run: yarn vercel deploy --prebuilt --token ${{ secrets.vercel_token }} > _vercel-deployment-url
|
2023-08-23 16:01:25 +00:00
|
|
|
- name: Comment on PR with deployment URL
|
2023-08-23 18:10:01 +00:00
|
|
|
uses: actions/github-script@v6
|
2023-08-23 16:01:25 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
const fs = require('fs');
|
|
|
|
const deploymentUrl = fs.readFileSync('_vercel-deployment-url', 'utf8');
|
2023-08-23 18:10:01 +00:00
|
|
|
await github.rest.issues.createComment({
|
2023-08-23 16:01:25 +00:00
|
|
|
issue_number: context.issue.number,
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
body: `Deployed to ${deploymentUrl}`,
|
|
|
|
});
|