|
1 |
| -name: ci |
| 1 | +name: Test |
2 | 2 | on:
|
3 |
| - push: |
4 |
| - branches: |
5 |
| - - master |
6 | 3 | pull_request:
|
7 | 4 | branches:
|
8 | 5 | - master
|
9 | 6 |
|
10 | 7 | 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 | +
|
11 | 35 | check:
|
| 36 | + name: Check |
| 37 | + needs: build |
12 | 38 | runs-on: ubuntu-latest
|
13 | 39 | 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 | +
|
19 | 66 | test-node:
|
20 |
| - needs: check |
| 67 | + name: Unit tests ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }} |
| 68 | + needs: build |
21 | 69 | runs-on: ${{ matrix.os }}
|
22 | 70 | strategy:
|
23 | 71 | matrix:
|
24 | 72 | os: [windows-latest, ubuntu-latest, macos-latest]
|
25 |
| - node: [14, 16] |
26 |
| - fail-fast: true |
| 73 | + node: [16] |
27 | 74 | steps:
|
28 | 75 | - uses: actions/checkout@v2
|
29 |
| - - uses: actions/setup-node@v1 |
| 76 | + with: |
| 77 | + fetch-depth: 0 |
| 78 | + - uses: actions/setup-node@v2 |
30 | 79 | with:
|
31 | 80 | 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 |
38 | 141 | runs-on: ubuntu-latest
|
39 | 142 | steps:
|
40 | 143 | - 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 |
45 | 173 | runs-on: ubuntu-latest
|
46 | 174 | steps:
|
47 | 175 | - 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 |
0 commit comments