-
-
Notifications
You must be signed in to change notification settings - Fork 7
191 lines (183 loc) · 6.78 KB
/
ppe.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: "PPE"
on:
push:
branches:
- main
jobs:
unit_tests_linux:
name: Verify Tests (Linux)
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.100"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:linux
package_for_ppe_linux:
name: Package for PPE (Linux)
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.100"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Package apps
run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packaged-apps
path: apps/*/.packaged
deploy_ppe:
name: Deploy affected to PPE
runs-on: self-hosted
needs:
- unit_tests_linux
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
ref: main
- name: Read Node version
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.403"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Deploy affected apps
run: yarn nx affected --target=deploy --parallel --verbose --projects=tag:linux
env:
CODECOV_TOKEN: ${{ secrets.CODE_COV_TOKEN }}
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
MQTT_HOST: ${{ secrets.K8S_MAIN_NODE_IP }}
MQTT_PORT: ${{ secrets.MQTT_PORT_EXTERNAL }}
MQTT_USERNAME: ${{ secrets.MQTT_USERNAME }}
MQTT_PASSWORD: ${{ secrets.MQTT_PASSWORD }}
NODE_ENV: production
unit_tests_windows:
name: Verify PR - Tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]20.9.0"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.100"
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@^4.0.0
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows
package_windows:
name: Package for PPE (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]20.9.0"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.100"
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@^4.0.0
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Package apps
run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packaged-apps
path: apps/*/.packaged