|
1 |
| -name: ci |
| 1 | +name: test & maybe release |
2 | 2 | on:
|
3 | 3 | push:
|
4 | 4 | branches:
|
|
8 | 8 | - master
|
9 | 9 |
|
10 | 10 | jobs:
|
| 11 | + |
11 | 12 | check:
|
12 | 13 | runs-on: ubuntu-latest
|
13 | 14 | steps:
|
14 | 15 | - uses: actions/checkout@v2
|
15 |
| - - run: npm install |
16 |
| - - run: npx aegir lint |
17 |
| - |
18 |
| - - run: npx aegir build --no-bundle |
19 |
| - - run: npx aegir dep-check |
| 16 | + - uses: actions/setup-node@v2 |
| 17 | + with: |
| 18 | + node-version: lts/* |
| 19 | + - uses: actions/cache@v2 |
| 20 | + id: cache |
| 21 | + env: |
| 22 | + CACHE_NAME: cache-node-modules |
| 23 | + with: |
| 24 | + path: | |
| 25 | + ~/.npm |
| 26 | + ./dist |
| 27 | + ./node_modules |
| 28 | + ./packages/*/dist |
| 29 | + ./packages/*/node_modules |
| 30 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 31 | + - name: Install Dependencies |
| 32 | + if: steps.cache.outputs.cache-hit != 'true' |
| 33 | + run: | |
| 34 | + npm install |
| 35 | + npm run --if-present build |
| 36 | + - run: npm run --if-present lint |
| 37 | + - run: npm run --if-present dep-check |
| 38 | + |
20 | 39 | test-node:
|
21 | 40 | needs: check
|
22 | 41 | runs-on: ${{ matrix.os }}
|
23 | 42 | strategy:
|
24 | 43 | matrix:
|
25 | 44 | os: [windows-latest, ubuntu-latest, macos-latest]
|
26 |
| - node: [14, 16] |
| 45 | + node: [16] |
27 | 46 | fail-fast: true
|
28 | 47 | steps:
|
29 | 48 | - uses: actions/checkout@v2
|
30 |
| - - uses: actions/setup-node@v1 |
| 49 | + - uses: actions/setup-node@v2 |
31 | 50 | with:
|
32 | 51 | node-version: ${{ matrix.node }}
|
33 |
| - - run: npm install |
34 |
| - - run: npm run pretest |
35 |
| - - run: npx nyc --reporter=lcov aegir test -t node -- --bail |
| 52 | + - uses: actions/cache@v2 |
| 53 | + id: cache |
| 54 | + env: |
| 55 | + CACHE_NAME: cache-node-modules |
| 56 | + with: |
| 57 | + path: | |
| 58 | + ~/.npm |
| 59 | + ./dist |
| 60 | + ./node_modules |
| 61 | + ./packages/*/dist |
| 62 | + ./packages/*/node_modules |
| 63 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 64 | + - name: Install Dependencies |
| 65 | + if: steps.cache.outputs.cache-hit != 'true' |
| 66 | + run: | |
| 67 | + npm install |
| 68 | + npm run --if-present build |
| 69 | + - run: npm run --if-present test:node -- --bail --cov |
36 | 70 | - uses: codecov/codecov-action@v1
|
| 71 | + |
| 72 | + test-chrome: |
| 73 | + needs: check |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v2 |
| 77 | + - uses: actions/setup-node@v2 |
| 78 | + with: |
| 79 | + node-version: lts/* |
| 80 | + - uses: actions/cache@v2 |
| 81 | + id: cache |
| 82 | + env: |
| 83 | + CACHE_NAME: cache-node-modules |
| 84 | + with: |
| 85 | + path: | |
| 86 | + ~/.npm |
| 87 | + ./dist |
| 88 | + ./node_modules |
| 89 | + ./packages/*/dist |
| 90 | + ./packages/*/node_modules |
| 91 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 92 | + - name: Install Dependencies |
| 93 | + if: steps.cache.outputs.cache-hit != 'true' |
| 94 | + run: | |
| 95 | + npm install |
| 96 | + npm run --if-present build |
| 97 | + - run: npm run --if-present test:browser -- -t browser -t webworker --bail |
| 98 | + |
| 99 | + test-firefox: |
| 100 | + needs: check |
| 101 | + runs-on: ubuntu-latest |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v2 |
| 104 | + - uses: actions/setup-node@v2 |
| 105 | + with: |
| 106 | + node-version: lts/* |
| 107 | + - uses: actions/cache@v2 |
| 108 | + id: cache |
| 109 | + env: |
| 110 | + CACHE_NAME: cache-node-modules |
| 111 | + with: |
| 112 | + path: | |
| 113 | + ~/.npm |
| 114 | + ./dist |
| 115 | + ./node_modules |
| 116 | + ./packages/*/dist |
| 117 | + ./packages/*/node_modules |
| 118 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 119 | + - name: Install Dependencies |
| 120 | + if: steps.cache.outputs.cache-hit != 'true' |
| 121 | + run: | |
| 122 | + npm install |
| 123 | + npm run --if-present build |
| 124 | + - run: npm run --if-present test:browser -- -t browser -t webworker --bail -- --browser firefox |
| 125 | + |
37 | 126 | test-electron-main:
|
38 | 127 | needs: check
|
39 | 128 | runs-on: ubuntu-latest
|
40 | 129 | steps:
|
41 | 130 | - uses: actions/checkout@v2
|
42 |
| - - run: npm install |
43 |
| - - run: npm run pretest |
44 |
| - - run: npx xvfb-maybe aegir test -t electron-main --bail -f dist/cjs/node-test/*js |
| 131 | + - uses: actions/setup-node@v2 |
| 132 | + with: |
| 133 | + node-version: lts/* |
| 134 | + - uses: actions/cache@v2 |
| 135 | + id: cache |
| 136 | + env: |
| 137 | + CACHE_NAME: cache-node-modules |
| 138 | + with: |
| 139 | + path: | |
| 140 | + ~/.npm |
| 141 | + ./dist |
| 142 | + ./node_modules |
| 143 | + ./packages/*/dist |
| 144 | + ./packages/*/node_modules |
| 145 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 146 | + - name: Install Dependencies |
| 147 | + if: steps.cache.outputs.cache-hit != 'true' |
| 148 | + run: | |
| 149 | + npm install |
| 150 | + npm run --if-present build |
| 151 | + - run: npx xvfb-maybe npm run --if-present test:electron-main -- --bail |
| 152 | + |
45 | 153 | test-electron-renderer:
|
46 | 154 | needs: check
|
47 | 155 | runs-on: ubuntu-latest
|
48 | 156 | steps:
|
49 | 157 | - uses: actions/checkout@v2
|
50 |
| - - run: npm install |
51 |
| - - run: npm run pretest |
52 |
| - - run: npx xvfb-maybe aegir test -t electron-renderer --bail -f dist/cjs/browser-test/*js |
| 158 | + - uses: actions/setup-node@v2 |
| 159 | + with: |
| 160 | + node-version: lts/* |
| 161 | + - uses: actions/cache@v2 |
| 162 | + id: cache |
| 163 | + env: |
| 164 | + CACHE_NAME: cache-node-modules |
| 165 | + with: |
| 166 | + path: | |
| 167 | + ~/.npm |
| 168 | + ./dist |
| 169 | + ./node_modules |
| 170 | + ./packages/*/dist |
| 171 | + ./packages/*/node_modules |
| 172 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 173 | + - name: Install Dependencies |
| 174 | + if: steps.cache.outputs.cache-hit != 'true' |
| 175 | + run: | |
| 176 | + npm install |
| 177 | + npm run --if-present build |
| 178 | + - run: npx xvfb-maybe npm run --if-present test:electron-renderer -- --bail |
| 179 | + |
| 180 | + release: |
| 181 | + needs: [test-node, test-chrome, test-firefox, test-electron-main] |
| 182 | + runs-on: ubuntu-latest |
| 183 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.author.name, 'Github Actions') |
| 184 | + steps: |
| 185 | + |
| 186 | + with: |
| 187 | + fetch-depth: 0 |
| 188 | + - uses: actions/setup-node@v2 |
| 189 | + with: |
| 190 | + node-version: lts/* |
| 191 | + - uses: actions/cache@v2 |
| 192 | + id: cache |
| 193 | + env: |
| 194 | + CACHE_NAME: cache-node-modules |
| 195 | + with: |
| 196 | + path: | |
| 197 | + ~/.npm |
| 198 | + ./dist |
| 199 | + ./node_modules |
| 200 | + ./packages/*/dist |
| 201 | + ./packages/*/node_modules |
| 202 | + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} |
| 203 | + - name: Install Dependencies |
| 204 | + if: steps.cache.outputs.cache-hit != 'true' |
| 205 | + run: | |
| 206 | + npm install |
| 207 | + npm run --if-present build |
| 208 | + - run: | |
| 209 | + git config --global user.email "[email protected]" |
| 210 | + git config --global user.name "Github Actions" |
| 211 | + if [[ -n "${NPM_TOKEN}" ]]; then |
| 212 | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc |
| 213 | + fi |
| 214 | + if [[ -n "${DOCKER_TOKEN}" ]] && [[ -n "${DOCKER_USERNAME}" ]]; then |
| 215 | + echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin |
| 216 | + fi |
| 217 | + npm run --if-present release |
| 218 | + env: |
| 219 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 220 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 221 | + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |
| 222 | + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} |
0 commit comments