Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

Commit 8c7f5de

Browse files
authored
feat: make into monorepo (#376)
Splits transport and server out into separate packages to reduce the amount of time it takes to install the transport when you don't need the server. BREAKING CHANGE: The transport module no longer includes the signalling server
1 parent b4e4180 commit 8c7f5de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+802
-309
lines changed

.github/workflows/main.yml

Lines changed: 176 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,200 @@
1-
name: ci
1+
name: Test
22
on:
3-
push:
4-
branches:
5-
- master
63
pull_request:
74
branches:
85
- master
96

107
jobs:
8+
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 16
17+
- uses: actions/cache@v2
18+
id: cache
19+
env:
20+
CACHE_NAME: cache-node-modules
21+
with:
22+
path: |
23+
~/.npm
24+
./node_modules
25+
./packages/*/node_modules
26+
./packages/*/dist
27+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
28+
- name: Install Dependencies
29+
if: steps.cache.outputs.cache-hit != 'true'
30+
run: |
31+
npm install
32+
npm run build --if-present
33+
npm run link --if-present
34+
1135
check:
36+
name: Check
37+
needs: build
1238
runs-on: ubuntu-latest
1339
steps:
14-
- uses: actions/checkout@v2
15-
- run: npm install
16-
- run: npx aegir lint
17-
- run: npx aegir dep-check -- -i wrtc -i electron-webrtc
18-
- run: npx aegir build --no-types
40+
- uses: actions/checkout@v2
41+
- uses: actions/setup-node@v2
42+
with:
43+
node-version: 16
44+
- uses: actions/cache@v2
45+
id: cache
46+
env:
47+
CACHE_NAME: cache-node-modules
48+
with:
49+
path: |
50+
~/.npm
51+
./node_modules
52+
./packages/*/node_modules
53+
./packages/*/dist
54+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
55+
- name: Install Dependencies
56+
if: steps.cache.outputs.cache-hit != 'true'
57+
run: |
58+
npm install
59+
npm run build --if-present
60+
npm run link --if-present
61+
- run: |
62+
npm run lint
63+
npm run dep-check -- -- -- -p
64+
npm run dep-check -- -- -- -- --unused
65+
1966
test-node:
20-
needs: check
67+
name: Unit tests ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }}
68+
needs: build
2169
runs-on: ${{ matrix.os }}
2270
strategy:
2371
matrix:
2472
os: [windows-latest, ubuntu-latest, macos-latest]
25-
node: [14, 16]
26-
fail-fast: true
73+
node: [16]
2774
steps:
2875
- uses: actions/checkout@v2
29-
- uses: actions/setup-node@v1
76+
with:
77+
fetch-depth: 0
78+
- uses: actions/setup-node@v2
3079
with:
3180
node-version: ${{ matrix.node }}
32-
- run: npm install @mapbox/node-pre-gyp -g
33-
- run: npm install
34-
- run: npm run test:node -- --cov --bail
35-
- uses: codecov/codecov-action@v1
36-
test-chrome:
37-
needs: check
81+
- uses: actions/cache@v2
82+
id: cache
83+
env:
84+
CACHE_NAME: cache-node-modules
85+
with:
86+
path: |
87+
~/.npm
88+
./node_modules
89+
./packages/*/node_modules
90+
./packages/*/dist
91+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
92+
- name: Install Dependencies
93+
if: steps.cache.outputs.cache-hit != 'true'
94+
run: |
95+
npm install
96+
npm run build --if-present
97+
npm run link --if-present
98+
- run: npm run test:node -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1
99+
100+
test-browser:
101+
name: Unit tests ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }}
102+
needs: build
103+
runs-on: ubuntu-latest
104+
strategy:
105+
matrix:
106+
browser:
107+
- chromium
108+
- firefox
109+
type:
110+
- browser
111+
- webworker
112+
steps:
113+
- uses: actions/checkout@v2
114+
with:
115+
fetch-depth: 0
116+
- uses: actions/setup-node@v2
117+
with:
118+
node-version: 16
119+
- uses: actions/cache@v2
120+
id: cache
121+
env:
122+
CACHE_NAME: cache-node-modules
123+
with:
124+
path: |
125+
~/.npm
126+
./node_modules
127+
./packages/*/node_modules
128+
./packages/*/dist
129+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
130+
- name: Install Dependencies
131+
if: steps.cache.outputs.cache-hit != 'true'
132+
run: |
133+
npm install
134+
npm run build --if-present
135+
npm run link --if-present
136+
- run: npm run test:browser -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- -- --browser ${{ matrix.browser }}
137+
138+
test-electron-main:
139+
name: Unit tests electron-main
140+
needs: build
38141
runs-on: ubuntu-latest
39142
steps:
40143
- uses: actions/checkout@v2
41-
- run: npm install
42-
- run: npm run test:browser -- --bail
43-
test-firefox:
44-
needs: check
144+
with:
145+
fetch-depth: 0
146+
- uses: actions/setup-node@v2
147+
with:
148+
node-version: 16
149+
- uses: actions/cache@v2
150+
id: cache
151+
env:
152+
CACHE_NAME: cache-node-modules
153+
with:
154+
path: |
155+
~/.npm
156+
./node_modules
157+
./packages/*/node_modules
158+
./packages/*/dist
159+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
160+
- name: Install Dependencies
161+
if: steps.cache.outputs.cache-hit != 'true'
162+
run: |
163+
npm install
164+
npm run build --if-present
165+
npm run link --if-present
166+
- uses: GabrielBB/xvfb-action@v1
167+
with:
168+
run: npm run test:electron-main -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- --bail
169+
170+
test-electron-renderer:
171+
name: Unit tests electron-renderer
172+
needs: build
45173
runs-on: ubuntu-latest
46174
steps:
47175
- uses: actions/checkout@v2
48-
- run: npm install
49-
- run: npm run test:browser -- --browser firefox --bail
176+
with:
177+
fetch-depth: 0
178+
- uses: actions/setup-node@v2
179+
with:
180+
node-version: 16
181+
- uses: actions/cache@v2
182+
id: cache
183+
env:
184+
CACHE_NAME: cache-node-modules
185+
with:
186+
path: |
187+
~/.npm
188+
./node_modules
189+
./packages/*/node_modules
190+
./packages/*/dist
191+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }}
192+
- name: Install Dependencies
193+
if: steps.cache.outputs.cache-hit != 'true'
194+
run: |
195+
npm install
196+
npm run build --if-present
197+
npm run link --if-present
198+
- uses: GabrielBB/xvfb-action@v1
199+
with:
200+
run: npm run test:electron-renderer -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- --bail

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ FROM node:lts-alpine as node
33
FROM node as builder
44

55
# Install deps
6-
RUN apk add --update git build-base python3 libressl-dev ca-certificates
6+
RUN apk add build-base python3 libressl-dev ca-certificates
77

88
# Setup directories for the `node` user
99
RUN mkdir -p /home/node/app/webrtc-star/node_modules && chown -R node:node /home/node/app/webrtc-star
1010

1111
WORKDIR /home/node/app/webrtc-star
1212

1313
# Install node modules
14-
COPY package.json ./
14+
COPY packages/signalling-server/package.json ./
1515
# Switch to the node user for installation
1616
RUN npm install --production
1717

1818
# Copy over source files under the node user
19-
COPY ./src ./src
20-
COPY ./README.md ./
19+
COPY ./packages/signalling-server/src ./src
20+
COPY ./packages/signalling-server/README.md ./
2121

2222
# Start from a clean node image
2323
FROM node as server
@@ -36,4 +36,4 @@ EXPOSE 9090
3636
# --port=9090 --host=0.0.0.0 --disableMetrics=false
3737
# Server logging can be enabled via the DEBUG environment variable:
3838
# DEBUG=signalling-server,signalling-server:error
39-
CMD [ "node", "src/sig-server/bin.js"]
39+
CMD [ "node", "src/bin.js"]

LICENSE-APACHE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 David Dias
4-
53
Permission is hereby granted, free of charge, to any person obtaining a copy
64
of this software and associated documentation files (the "Software"), to deal
75
in the Software without restriction, including without limitation the rights
86
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
97
copies of the Software, and to permit persons to whom the Software is
108
furnished to do so, subject to the following conditions:
119

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
1412

1513
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1614
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1715
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1816
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1917
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)