Skip to content
Draft
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
49 changes: 27 additions & 22 deletions .github/workflows/branch-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ jobs:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npm run storybook:build
shell: bash
- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /md-editor/branches/${{ github.ref_name }}/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Build Storybook
run: pnpm run sb:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /md-editor/branches/${{ github.ref_name }}/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
94 changes: 57 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,70 @@ jobs:
name: Verify Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Lint Files
run: pnpm run lint

- name: Typecheck
run: pnpm run typecheck

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
- name: Unit Tests
run: npm run test
- name: ESBuild compatability
run: npm run test:esbuild
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Unit Tests
run: pnpm run test

- name: ESBuild compatability
run: pnpm run test:esbuild

check_circular_deps:
name: Check Circular Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
- name: Check circular dependencies
run: npm run check-circular-deps
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Check circular dependencies
run: pnpm run check-circular-deps
45 changes: 25 additions & 20 deletions .github/workflows/main-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ jobs:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npm run storybook:build
shell: bash
- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /md-editor/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Build Storybook
run: pnpm run sb:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /md-editor/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
13 changes: 0 additions & 13 deletions .github/workflows/pr-preview-build.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/pr-preview-deploy.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: PR Preview

on:
pull_request:

jobs:
main:
name: Build and Deploy Storybook
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Install Storybook CLI
run: pnpm i @storybook/cli@8.4.1

- name: Build Storybook
run: pnpm run sb:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /md-editor/pulls/${{ github.event.pull_request.number }}/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}

- name: Create token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.GRAVITY_UI_APP_ID }}
private-key: ${{ secrets.GRAVITY_UI_APP_PRIVATE_KEY }}

- name: Create Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
header: preview
number: ${{ github.event.pull_request.number }}
message: '[![Storybook Deployed](https://img.shields.io/badge/Storybook-Deployed-FF4785?logo=storybook&style=for-the-badge)](https://preview.gravity-ui.com/md-editor/${{ github.event.pull_request.number }}/)'
17 changes: 14 additions & 3 deletions .github/workflows/pr-visual-tests-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@ jobs:
if: github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Create token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.GRAVITY_UI_APP_ID }}
private-key: ${{ secrets.GRAVITY_UI_APP_PRIVATE_KEY }}

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
run-id: ${{ github.event.workflow_run.id }}

- name: Extract PR Number
id: pr
run: echo "::set-output name=id::$(<pr/pr-id.txt)"
shell: bash

- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@v1
with:
version: 2.22.35
arch: amd64

- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }}
Expand All @@ -34,10 +44,11 @@ jobs:
AWS_EC2_METADATA_DISABLED: true
run: aws s3 cp playwright-report s3://playwright-reports/markdown-editor/pulls/${{ steps.pr.outputs.id}}/ --endpoint-url=https://storage.yandexcloud.net --recursive
shell: bash

- name: Create Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
number: ${{ steps.pr.outputs.id }}
header: visual tests report
message: '[Visual Tests Report](https://storage.yandexcloud.net/playwright-reports/markdown-editor/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.'
message: '[![Playwright Report](https://img.shields.io/badge/Playwright-Report-45ba4b?style=for-the-badge&labelColor=2b3137)](https://storage.yandexcloud.net/playwright-reports/markdown-editor/pulls/${{ steps.pr.outputs.id }}/index.html)'
25 changes: 18 additions & 7 deletions .github/workflows/pr-visual-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,41 @@ jobs:
container:
image: mcr.microsoft.com/playwright:v1.49.0-jammy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install Packages
run: npm ci
node-version-file: '.nvmrc'
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Run Visual Tests
run: npm run playwright
run: pnpm run playwright
env:
CI: 'true'

- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: ./playwright-report
retention-days: 1

- name: Save PR ID
if: always()
run: |
pr="${{ github.event.pull_request.number }}"
echo $pr > ./pr-id.txt
shell: bash

- name: Create PR Artifact
if: always()
uses: actions/upload-artifact@v4
Expand Down
Loading
Loading