feat(playwright): add playwright e2e on checkbox list #18425
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
merge_group: | |
pull_request: | |
types: ["opened", "edited", "reopened", "synchronize"] | |
push: | |
branches: | |
- main | |
jobs: | |
manypkg: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm exec manypkg check | |
typecheck: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm typecheck | |
oxlint: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm oxlint -c .oxlintrc.json --quiet | |
lint: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm run lint | |
format: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm run format:ci | |
test: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
needs: [typecheck, format] | |
strategy: | |
matrix: | |
node: ["22"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 10 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node }} | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm run test:unit:coverage | |
- uses: codecov/[email protected] | |
with: | |
# files: packages/**/coverage/cobertura-coverage.xmls | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
# accessibility: | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: '0' | |
# - uses: pnpm/[email protected] | |
# - name: Use Node.js | |
# uses: actions/[email protected] | |
# with: | |
# node-version: 22 | |
# cache: 'pnpm' | |
# - run: pnpm install | |
# - run: pnpm run build | |
# - run: pnpm install | |
# - run: pnpm run test:a11y | |
build: | |
strategy: | |
matrix: | |
node: ["22"] | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
needs: [typecheck, format] | |
steps: | |
- uses: actions/checkout@v4 # v4.1.4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node }} | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm run build | |
publint: | |
runs-on: ubuntu-24.04 | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- run: | | |
pnpm install --frozen-lockfile | |
pnpm publint | |
deploy: | |
runs-on: ubuntu-24.04 | |
needs: [publint, typecheck, build] | |
env: | |
IMAGE_NAME: rg.fr-par.scw.cloud/ultraviolet/storybook | |
DEPLOYMENT_NAME: "storybook" | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_CACHE: "remote:rw" | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#example-usage-of-the-jobs-context | |
outputs: | |
base_url: ${{ steps.deploy.outputs.url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v5 | |
- name: Export custom variables | |
run: | | |
SAFE_GITHUB_HEAD_REF_SLUG_URL=$(echo $GITHUB_HEAD_REF_SLUG_URL-$DEPLOYMENT_NAME | rev | cut -c-37 | rev | awk '{gsub(/^-/, ""); print}') | |
([[ $GITHUB_REF == 'refs/heads/main' ]] && echo "STORYBOOK_BRANCH_SLUG=main" || echo "STORYBOOK_BRANCH_SLUG=$SAFE_GITHUB_HEAD_REF_SLUG_URL") >> $GITHUB_ENV | |
- name: Start deployment | |
uses: bobheadxi/[email protected] | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GH_TOKEN }} | |
env: ${{ env.DEPLOYMENT_NAME }} | |
ref: ${{ github.head_ref }} | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: rg.fr-par.scw.cloud/ultraviolet | |
username: nologin | |
password: ${{ secrets.SCW_SECRET_KEY }} | |
- name: Build | |
uses: docker/build-push-action@v6 | |
env: | |
IMAGE: ${{ env.IMAGE_NAME }}:${{ env.STORYBOOK_BRANCH_SLUG }} | |
SOURCE_DATE_EPOCH: 0 | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
with: | |
push: true | |
tags: ${{ env.IMAGE }} | |
file: Dockerfile | |
cache-from: type=local,src=/tmp/docs/.buildx-cache | |
cache-to: type=local,dest=/tmp/docs/.buildx-cache-new,mode=max | |
- name: Set scw_max_concurrency | |
id: set-max-concurrency | |
run: | | |
if [[ "${{ env.STORYBOOK_BRANCH_SLUG }}" == "main" ]]; then | |
echo "SCW_MAX_CONCURRENCY=30" >> $GITHUB_ENV | |
else | |
echo "SCW_MAX_CONCURRENCY=10" >> $GITHUB_ENV | |
fi | |
- name: Set scw_min_scale | |
id: set-min-scale | |
run: | | |
if [[ "${{ env.STORYBOOK_BRANCH_SLUG }}" == "main" ]]; then | |
echo "SCW_MIN_SCALE=1" >> $GITHUB_ENV | |
else | |
echo "SCW_MIN_SCALE=0" >> $GITHUB_ENV | |
fi | |
- name: Set scw_limit | |
id: set-cpu-limit | |
run: | | |
if [[ "${{ env.STORYBOOK_BRANCH_SLUG }}" == "main" ]]; then | |
echo "SCW_CPU_LIMIT=500" >> $GITHUB_ENV | |
echo "SCW_MEMORY_LIMIT=1024" >> $GITHUB_ENV | |
else | |
echo "SCW_CPU_LIMIT=250" >> $GITHUB_ENV | |
echo "SCW_MEMORY_LIMIT=256" >> $GITHUB_ENV | |
fi | |
- name: Deploy Serverless Container Scaleway | |
uses: philibea/[email protected] | |
id: deploy | |
with: | |
type: "deploy" | |
scw_dns: "storybook.ultraviolet.scaleway.com" | |
root_zone: ${{ env.STORYBOOK_BRANCH_SLUG == 'main' }} | |
scw_access_key: ${{ secrets.SCW_ACCESS_KEY }} | |
scw_secret_key: ${{ secrets.SCW_SECRET_KEY }} | |
scw_containers_namespace_id: ${{ secrets.SCW_CONTAINERS_NAMESPACE_ID }} | |
scw_environment_variables: "GITHUB=DEPLOY" | |
scw_registry: ${{ env.IMAGE_NAME }}:${{ env.STORYBOOK_BRANCH_SLUG }} | |
scw_min_scale: ${{ env.SCW_MIN_SCALE }} | |
scw_cpu_limit: ${{ env.SCW_CPU_LIMIT }} | |
scw_max_concurrency: ${{ env.SCW_MAX_CONCURRENCY }} | |
scw_sandbox: "v2" | |
scw_memory_limit: ${{ env.SCW_MEMORY_LIMIT }} | |
- name: Update deployment status | |
uses: bobheadxi/[email protected] | |
if: always() | |
with: | |
step: finish | |
env: ${{ env.DEPLOYMENT_NAME }} | |
token: ${{ secrets.GH_TOKEN }} | |
auto_inactive: true | |
# This will now be automatically handled by github with the auto_inactive | |
override: false | |
status: ${{ job.status }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
env_url: ${{ steps.deploy.outputs.url }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/docs/.buildx-cache | |
mv /tmp/docs/.buildx-cache-new /tmp/docs/.buildx-cache | |
e2e: | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
needs: [deploy] | |
env: | |
CI: true | |
TURBO_CACHE: "remote:rw" | |
BASE_URL: ${{ needs.deploy.outputs.base_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
cache: "pnpm" | |
- name: install pnpm deps | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm exec playwright install --with-deps | |
- name: run e2e | |
run: pnpm run test:e2e | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 5 |