-
Notifications
You must be signed in to change notification settings - Fork 19
155 lines (143 loc) · 5.01 KB
/
build.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
155
name: Build
on:
push:
branches:
- release/*
pull_request:
branches: [main]
paths:
- "tdrive/backend/node/**"
- "tdrive/frontend/**"
- "tdrive/connectors/onlyoffice-connector/**"
- "tdrive/backend/utils/ldap-sync/**"
- "tdrive/backend/utils/nextcloud-migration/**"
jobs:
setup:
name: Setup jobs
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- "tdrive/backend/node/**"
frontend:
- "tdrive/frontend/**"
onlyoffice-connector:
- "tdrive/connectors/onlyoffice-connector/**"
ldap-sync:
- "tdrive/backend/utils/ldap-sync/**"
nextcloud-migration:
- "tdrive/backend/utils/nextcloud-migration/**"
lint-backend:
runs-on: ubuntu-latest
if: contains(needs.setup.outputs.changes, 'backend')
needs:
- setup
steps:
- uses: actions/checkout@v4
- name: Prettier code style check
run: |
cd tdrive
docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint:prettier
- name: Lint
run: |
cd tdrive
docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint
test-backend:
runs-on: ubuntu-latest
if: contains(needs.setup.outputs.changes, 'backend')
needs:
- setup
steps:
- uses: actions/checkout@v4
- name: e2e-mongo-s3-test
run: |
cd tdrive
docker-compose -f docker-compose.tests.yml run --rm -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:all
docker-compose -f docker-compose.tests.yml down
- name: e2e-opensearch-test
run: |
cd tdrive
docker-compose -f docker-compose.dev.tests.opensearch.yml up -d --force-recreate opensearch-node1 postgres node
sleep 60
docker-compose -f docker-compose.dev.tests.opensearch.yml logs
docker-compose -f docker-compose.dev.tests.opensearch.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=opensearch -e DB_DRIVER=postgres -e PUBSUB_TYPE=local node npm run test:all
docker-compose -f docker-compose.dev.tests.opensearch.yml down
- name: coverage
uses: adRise/jest-cov-reporter@e13d7638888cad7788298f4022b203b31a10c7c8
with:
branch-coverage-report-path: ./tdrive/coverage/coverage-summary.json
base-coverage-report-path: ./tdrive/coverage/coverage-summary.json
delta: 0.3
fullCoverageDiff: true
build-frontend:
runs-on: ubuntu-latest
if: contains(needs.setup.outputs.changes, 'frontend')
needs:
- setup
env:
FRONTEND_ENV: ${{ secrets.FRONTEND_ENV }}
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: cd tdrive/frontend/ && yarn install
- run: cp tdrive/frontend/src/app/environment/environment.ts.dist tdrive/frontend/src/app/environment/environment.ts
- if: ${{ env.FRONTEND_ENV }}
run: echo ${{ secrets.FRONTEND_ENV }} > tdrive/frontend/src/app/environment/environment.ts
- run: cd tdrive/frontend/ && yarn test
- run: cd tdrive/frontend/ && yarn build
- name: Upload frontend build artifact
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: tdrive/frontend/build/
build-onlyoffice-connector:
runs-on: ubuntu-latest
if: contains(needs.setup.outputs.changes, 'onlyoffice-connector')
needs:
- setup
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies and build
run: |
cd tdrive/connectors/onlyoffice-connector
npm i
npm run build --if-present
npm run lint
build-ldap-sync:
runs-on: ubuntu-20.04
if: contains(needs.setup.outputs.changes, 'ldap-sync')
needs:
- setup
steps:
- uses: actions/checkout@v4
- name: Build ldap sync
run: cd tdrive/backend/utils/ldap-sync && npm i && npm run build
build-nextcloud-migration:
runs-on: ubuntu-20.04
if: contains(needs.setup.outputs.changes, 'nextcloud-migration')
needs:
- setup
steps:
- uses: actions/checkout@v4
- name: Build Nextcloud migration
run: cd tdrive/backend/utils/nextcloud-migration && npm i && npm run build