-
Notifications
You must be signed in to change notification settings - Fork 11
211 lines (181 loc) · 6.58 KB
/
Copy pathtest.yml
File metadata and controls
211 lines (181 loc) · 6.58 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Test
on:
pull_request:
push:
branches: [main]
env:
PNPM_VERSION: 10.27.0
NODE_VERSION: 24.15.0
OCIS_URL: https://localhost:9200
jobs:
license-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install REUSE tool
run: pip install reuse
- name: Run REUSE lint
run: reuse lint
dependency-license-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Check dependency licenses
run: |
# @ownclouders/* packages are company-owned and externalized from build output — excluded from scan
npx license-checker --production \
--failOn "GPL-2.0;GPL-3.0;AGPL-3.0;AGPL-1.0" \
--excludePackages "@ownclouders/web-client;@ownclouders/web-pkg;@ownclouders/design-system" \
--excludePrivatePackages
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Check types
run: pnpm check:types
- name: Lint
run: pnpm lint
test:
runs-on: ubuntu-latest
needs: check
strategy:
fail-fast: false
matrix:
app:
- web-app-advanced-search
- web-app-cast
- web-app-draw-io
- web-app-external-sites
- web-app-importer
- web-app-json-viewer
- web-app-photo-addon
- web-app-progress-bars
- web-app-unzip
- web-app-ai-doc-summary
- web-app-ai-quick-draft-creator
- web-app-ai-image-alt-text-sidebar
- web-app-chat-with-file
- ai-llm-proxy
- web-app-version-changelog
- web-app-group-management
- web-app-file-comments
- web-app-ai-folder-brief-sidebar
- web-app-ai-sensitive-data-scanner
- web-app-ai-data-insights-sidebar
- web-app-ai-multi-doc-synthesizer
- web-app-ai-smart-file-tagger-qa
- web-app-ai-smart-collections-nav
- web-app-ai-folder-readme-generator
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run unit tests
run: pnpm --filter ./packages/${{ matrix.app }} test:unit
- name: Build
run: pnpm --filter ./packages/${{ matrix.app }} build
- name: Copy manifest
if: matrix.app == 'web-app-external-sites'
run: cp ./packages/web-app-external-sites/tests/config/manifest.json ./packages/web-app-external-sites/dist/manifest.json
- name: Setup oCIS
run: |
docker run -d --name ocis \
-p 9200:9200 \
-e OCIS_URL=${{ env.OCIS_URL }} \
-e OCIS_INSECURE=true \
-e OCIS_LOG_LEVEL=error \
-e IDM_ADMIN_PASSWORD=admin \
-e PROXY_ENABLE_BASIC_AUTH=true \
-e WEB_ASSET_APPS_PATH=/apps \
-e WEB_UI_CONFIG_FILE=/web/config.json \
-e PROXY_CSP_CONFIG_FILE_LOCATION=/etc/ocis/csp.yaml \
-v ${{github.workspace}}/packages/${{matrix.app}}/dist:/apps/${{matrix.app}} \
-v ${{github.workspace}}/support/actions/ocis.web.config.json:/web/config.json \
-v ${{github.workspace}}/dev/docker/csp.yaml:/etc/ocis/csp.yaml \
-v ${{github.workspace}}/support/actions/ocis.apps.yaml:/etc/ocis/apps.yaml \
--entrypoint sh \
owncloud/ocis-rolling:latest \
-c "ocis init || true && ocis server"
- name: Wait for oCIS
run: |
echo "Waiting for oCIS"
# 150s timeout
for i in {1..30}; do
if curl -kfsSL "${{ env.OCIS_URL }}" > /dev/null; then
echo "oCIS is up ✅"
exit 0
fi
echo "Retrying in 5s..."
sleep 5
done
echo "❌ oCIS failed to start"
docker logs ocis
exit 1
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps
- name: Run E2E tests
env:
BASE_URL_OCIS: ${{ env.OCIS_URL }}
OCIS_PASSWORD: admin
run: pnpm --filter ./packages/${{ matrix.app }} test:e2e
- name: Upload test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: test-results-${{ matrix.app }}
path: ./packages/${{ matrix.app }}/test-results/
retention-days: 7
- name: Dump oCIS logs
if: failure()
run: docker logs ocis
check-tests-passed:
needs: [license-check, dependency-license-check, check, test]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all test jobs passed
run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
exit 1
fi