diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 5199a04ed1..12b75d6cc9 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,8 +1,6 @@ name: Playwright Tests on: - # push: - # branches: [main, next] pull_request: jobs: @@ -10,40 +8,32 @@ jobs: 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: Upload Playwright report - if: always() - env: - AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} - AWS_DEFAULT_REGION: ru-central1 - AWS_EC2_METADATA_DISABLED: true - run: aws s3 cp ./playwright-report s3://playwright-reports/uikit/pulls/${{ github.event.pull_request.number }}/ --endpoint-url=https://storage.yandexcloud.net --recursive - shell: bash - - name: Create Comment - if: always() - uses: marocchino/sticky-pull-request-comment@v2 - with: - GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} - number: ${{ github.event.pull_request.number }} - header: playwright test - message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/uikit/pulls/${{ github.event.pull_request.number }}/index.html) is ready.' - \ No newline at end of file + - 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 + run: | + pr="${{ github.event.pull_request.number }}" + echo $pr > ./pr-id.txt + shell: bash + - name: Create PR Artifact + 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 new file mode 100644 index 0000000000..03a81dc3a6 --- /dev/null +++ b/.github/workflows/pr-playwright-report.yml @@ -0,0 +1,38 @@ +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::$(