-
-
Notifications
You must be signed in to change notification settings - Fork 110
154 lines (148 loc) · 4.94 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
wmr: ${{ steps.filter.outputs.wmr }}
preact-iso: ${{ steps.filter.outputs.preact-iso }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
wmr:
- 'packages/wmr/**'
- 'examples/demo/**'
preact-iso:
- 'packages/preact-iso/**'
wmr-prod-test:
needs: changes
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn --prefer-offline --frozen-lockfile --non-interactive --silent
- name: Build
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn wmr build
- name: Test production
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn wmr test-prod
wmr-dev-test:
needs: changes
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn --prefer-offline --frozen-lockfile --non-interactive --silent
- name: Test wmr
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn eslint packages/wmr && yarn wmr test
preact-iso-test:
needs: changes
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
if: ${{ needs.changes.outputs.preact-iso == 'true' }}
run: yarn --prefer-offline --frozen-lockfile --non-interactive --silent
- name: Test preact-iso
if: ${{ needs.changes.outputs.preact-iso == 'true' }}
run: yarn eslint packages/preact-iso && yarn iso test
lhci:
needs: changes
if: ${{ needs.changes.outputs.wmr == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Prepare LHCI
run: npm install -g @lhci/[email protected]
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: yarn --prefer-offline --frozen-lockfile --non-interactive --silent
- name: Build
run: yarn ci
- name: LHCI
run: lhci autorun --upload.target=temporary-public-storage --collect.url="http://localhost:8080" --collect.startServerCommand="yarn workspace @examples/demo serve" --collect.startServerReadyPattern="server running at" --upload.githubAppToken=${{ secrets.LHCI_GITHUB_APP_TOKEN }}