-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kezhik Kyzyl-ool
committed
Apr 22, 2024
1 parent
d5a84a7
commit 839e089
Showing
6 changed files
with
164 additions
and
158 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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::$(<pr/pr-id.txt)" | ||
shell: bash | ||
- name: Upload | ||
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/${{ 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 }} | ||
number: ${{ steps.pr.outputs.id }} | ||
header: playwright test | ||
message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/uikit/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: PR Preview Build | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: gravity-ui/preview-build-action@v1 | ||
with: | ||
node-version: 18 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: PR Preview Deploy | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['PR Preview Build'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Artifacts from triggered workflow | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: ${{ github.event.workflow_run.workflow_id }} | ||
run_id: ${{ github.event.workflow_run.id }} | ||
# running this step only if this action was run by `on.workflow_run` | ||
if: > | ||
github.event.workflow_run.conclusion == 'success' | ||
- name: Download Artifacts from current workflow | ||
uses: actions/download-artifact@v3 | ||
# running this step only if this action running in the same workflow as preview-build-action's workflow | ||
if: > | ||
github.event.workflow_run.conclusion == null | ||
- name: Extract PR Number | ||
id: pr | ||
run: echo "::set-output name=id::$(<pr/pr-id.txt)" | ||
shell: bash | ||
- name: Upload to S3 | ||
uses: gravity-ui/preview-upload-to-s3-action@v1 | ||
with: | ||
src-path: static | ||
dest-path: /${{ inputs.project }}/pulls/${{ steps.pr.outputs.id }}/ | ||
s3-key-id: ${{ inputs.s3-key-id }} | ||
s3-secret-key: ${{ inputs.s3-secret-key }} | ||
- name: Create Comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
GITHUB_TOKEN: ${{ inputs.github-token }} | ||
number: ${{ steps.pr.outputs.id }} | ||
message: '[Preview](https://preview.gravity-ui.com/${{ inputs.project }}/${{ steps.pr.outputs.id }}/) is ready.' | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: PR Storybook Tests | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['PR Preview Deploy'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
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 |