-
Notifications
You must be signed in to change notification settings - Fork 5
130 lines (110 loc) · 3.83 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI Build
on:
# Trigger the workflow on push or pull request,
# but only for the main branch on Push and any branches on PR
push:
branches: [main,next]
pull_request_target:
jobs:
run:
name: Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [18, 20]
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 3
- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run pnpm install dependencies
run: pnpm install
- run: pnpm --version
- name: Prettier Check
run: pnpm prettier:check
- name: Build Library
run: pnpm build:lib
- name: Build Website (GitHub demo site)
run: pnpm build:demo
- name: Install Playwright Browsers (chromium)
run: pnpm exec playwright install chromium
- name: Start HTTP Server
run: pnpm serve:demo &
- name: Find Playwright Summary Comment (when exist)
if: ${{ github.event.pull_request.number }}
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Playwright Summary
- name: Run Playwright E2E Tests
uses: mathiasvr/[email protected]
id: playwrightsummary
with:
run: pnpm test:e2e
- name: Define Playwright Outcome Text
id: pw_outcome
if: always()
run: |
if [ ${{ steps.playwrightsummary.outcome }} == 'failure' ]; then
printf "pw_outcome=Failure :rotating_light:" >> $GITHUB_OUTPUT
else
echo "pw_outcome=Success :tada:" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Upsert Playwright Summary
if: |
github.event.pull_request.number &&
always()
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## :performing_arts: Playwright Summary - ${{ steps.pw_outcome.outputs.pw_outcome }}
### [Playwright Report](https://ghiscoding.github.io/multiple-select-vanilla/playwright-report)
${{ steps.playwrightsummary.outputs.stdout }} ${{ steps.playwrightsummary.outputs.stderr }}
edit-mode: replace
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 15
- name: Deploy Demo to gh-pages
if: |
github.ref == 'refs/heads/main' &&
(contains(github.event.head_commit.message, 'chore(release)') || contains(github.event.head_commit.message, '[refresh gh-pages]'))
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./demo/dist
- name: Deploy Playwright Report
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: playwright-report
publish_dir: ./playwright-report