diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index a6402a74f5..0000000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Playwright Tests - -on: - pull_request: - -jobs: - test: - name: Test component - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npm run playwright - env: - CI: 'true' - - name: Upload Playwright playwright report to GitHub Actions Artifacts - if: always() - uses: actions/upload-artifact@v3 - 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@v3 - with: - name: pr - path: ./pr-id.txt diff --git a/.github/workflows/pr-playwright-report.yml b/.github/workflows/pr-playwright-report.yml deleted file mode 100644 index 03a81dc3a6..0000000000 --- a/.github/workflows/pr-playwright-report.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: PR Playwright Report - -on: - workflow_run: - workflows: ['Playwright Tests'] - types: - - completed - -jobs: - comment: - name: Upload Playwright report to s3 - if: github.event.workflow_run.event == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: Download Artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - - name: Extract PR Number - id: pr - run: echo "::set-output name=id::$( - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - steps: - - uses: gravity-ui/preview-deploy-action@v1 - with: - project: uikit - github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} - s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }} - s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000000..473cf26f3b --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,105 @@ +name: PR Preview + +on: + pull_request: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: gravity-ui/preview-build-action@v1 + with: + node-version: 18 + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + steps: + - uses: gravity-ui/preview-deploy-action@v1 + with: + project: uikit + github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} + s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }} + s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} + storybook-tests: + name: Storybook Tests + needs: deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Storybook Tests + env: + PR_PREVIEW_URL: "https://preview.gravity-ui.com/uikit/${{github.event.pull_request.number}}" + run: npm run test-storybook + playwright-tests: + name: Test component + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npm run playwright + env: + CI: 'true' + - name: Upload Playwright playwright report to GitHub Actions Artifacts + if: always() + uses: actions/upload-artifact@v3 + 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@v3 + with: + name: pr + path: ./pr-id.txt + playwright-report: + name: Upload Playwright report to s3 + needs: playwright-tests + runs-on: ubuntu-latest + steps: + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + - name: Extract PR Number + id: pr + run: echo "::set-output name=id::$(