-
Notifications
You must be signed in to change notification settings - Fork 78
108 lines (89 loc) · 2.83 KB
/
test-app.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
name: Test-app
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-pal:
name: Build PAL
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
react:
- 'packages/react/**'
- name: Increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Use Node.js
uses: actions/setup-node@v4
if: steps.changes.outputs.react == 'true'
with:
node-version: '16.x'
- name: Cache dependencies
uses: actions/cache@v4
if: steps.changes.outputs.react == 'true'
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.changes.outputs.react == 'true'
run: |
yarn --frozen-lockfile
yarn lerna run --stream postinstall
yarn lerna link
- name: Run build
if: steps.changes.outputs.react == 'true'
run: |
cd packages/react
yarn build
mkdir -p dist
cp -rf package.json umd scss lib es css ./dist
- name: Archive build artifacts
if: ${{ success() }} && steps.changes.outputs.react == 'true'
uses: actions/upload-artifact@v4
with:
name: dist
path: packages/react/dist
create-test-app:
name: Create test app and build
needs: build-pal
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
react:
- 'packages/react/**'
- name: Use Node.js
uses: actions/setup-node@v4
if: steps.changes.outputs.react == 'true'
with:
node-version: '16.x'
- name: Run cli command to create test app
if: steps.changes.outputs.react == 'true'
run: |
npx create-iot-react-app test-app
- name: Download all build artifacts
if: steps.changes.outputs.react == 'true'
uses: actions/download-artifact@v4
- name: Link dependencies and build test app
if: steps.changes.outputs.react == 'true'
run: |
cd dist
yarn install --frozen-lockfile --production
yarn link
cd ../test-app
yarn link carbon-addons-iot-react
yarn build
- name: Serve app
if: ${{ success() }}
run: timeout 40s npx serve -s ../../../test-app/build || CODE="$?"; if [[ "$CODE" -ne 124 ]]; then exit $CODE; else exit 0; fi