|
| 1 | +# This workflow will do a clean install of node dependencies, cache/restore |
| 2 | +# them, build the source code and run tests across different versions of node |
| 3 | +# For more information see: |
| 4 | +# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 5 | +# |
| 6 | +# See supported Node.js release schedule at |
| 7 | +# https://nodejs.org/en/about/releases/ |
| 8 | + |
| 9 | +name: PouchDB CI |
| 10 | + |
| 11 | +on: |
| 12 | + push: {} |
| 13 | + pull_request: |
| 14 | + branches: [master] |
| 15 | + |
| 16 | +env: |
| 17 | + NODE_VERSION: 14 |
| 18 | + TEST_HOST: localhost |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + lint: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + - uses: ./.github/actions/install-deps |
| 27 | + with: |
| 28 | + node-version: ${{ env.NODE_VERSION }} |
| 29 | + - run: npm run eslint |
| 30 | + |
| 31 | + # Run the integration, find and mapreduce tests against CouchDB on Node.js. |
| 32 | + # This should be run against every version of CouchDB and every version of |
| 33 | + # Node.js we support. |
| 34 | + |
| 35 | + couchdb-nodejs: |
| 36 | + needs: lint |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + couchdb: ['2.3', '3.1'] |
| 41 | + node: [14, 16] |
| 42 | + cmd: |
| 43 | + - npm test |
| 44 | + - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test |
| 45 | + - TYPE=mapreduce ADAPTERS=http npm test |
| 46 | + runs-on: ubuntu-latest |
| 47 | + env: |
| 48 | + CLIENT: node |
| 49 | + SERVER: couchdb-master |
| 50 | + COUCH_HOST: http://admin:[email protected]:5984 |
| 51 | + SKIP_MIGRATION: 1 |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v3 |
| 54 | + - uses: ./.github/actions/install-deps |
| 55 | + with: |
| 56 | + node-version: ${{ matrix.node }} |
| 57 | + couchdb-version: ${{ matrix.couchdb }} |
| 58 | + - id: test |
| 59 | + run: ${{ matrix.cmd }} |
| 60 | + continue-on-error: true |
| 61 | + - name: First retry |
| 62 | + id: retry |
| 63 | + if: steps.test.outcome == 'failure' |
| 64 | + run: ${{ matrix.cmd }} |
| 65 | + continue-on-error: true |
| 66 | + - name: Second retry |
| 67 | + if: steps.retry.outcome == 'failure' |
| 68 | + run: ${{ matrix.cmd }} |
| 69 | + |
| 70 | + # Run the integration, find and mapreduce tests against CouchDB in the |
| 71 | + # browser. This should be run against every version of CouchDB we support and |
| 72 | + # every target browser. |
| 73 | + |
| 74 | + couchdb-browser: |
| 75 | + needs: lint |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: |
| 79 | + couchdb: ['2.3','3.1'] |
| 80 | + client: ['firefox', 'chromium'] |
| 81 | + cmd: |
| 82 | + - npm test |
| 83 | + - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test |
| 84 | + - TYPE=mapreduce ADAPTERS=http npm test |
| 85 | + runs-on: ubuntu-latest |
| 86 | + env: |
| 87 | + POUCHDB_SRC: ../../packages/node_modules/pouchdb/dist/pouchdb.min.js |
| 88 | + CLIENT: ${{ matrix.client }} |
| 89 | + SERVER: couchdb-master |
| 90 | + COUCH_HOST: http://admin:[email protected]:5984 |
| 91 | + SKIP_MIGRATION: 1 |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v3 |
| 94 | + - uses: ./.github/actions/install-deps |
| 95 | + with: |
| 96 | + node-version: ${{ env.NODE_VERSION }} |
| 97 | + couchdb-version: ${{ matrix.couchdb }} |
| 98 | + - id: test |
| 99 | + run: ${{ matrix.cmd }} |
| 100 | + continue-on-error: true |
| 101 | + - name: First retry |
| 102 | + id: retry |
| 103 | + if: steps.test.outcome == 'failure' |
| 104 | + run: ${{ matrix.cmd }} |
| 105 | + continue-on-error: true |
| 106 | + - name: Second retry |
| 107 | + if: steps.retry.outcome == 'failure' |
| 108 | + run: ${{ matrix.cmd }} |
| 109 | + |
| 110 | + # Run the integration, find and mapreduce tests against all the Node.js |
| 111 | + # PouchDB adapters. This should be run for every adapter on every version of |
| 112 | + # Node.js we support. |
| 113 | + |
| 114 | + nodejs-adapter: |
| 115 | + needs: lint |
| 116 | + strategy: |
| 117 | + fail-fast: false |
| 118 | + matrix: |
| 119 | + node: [14, 16] |
| 120 | + adapter: ['leveldb', 'memory'] |
| 121 | + cmd: |
| 122 | + - npm test |
| 123 | + - TYPE=find PLUGINS=pouchdb-find npm test |
| 124 | + - TYPE=mapreduce npm test |
| 125 | + runs-on: ubuntu-latest |
| 126 | + env: |
| 127 | + CLIENT: node |
| 128 | + ADAPTERS: ${{ matrix.adapter }} |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v3 |
| 131 | + - uses: ./.github/actions/install-deps |
| 132 | + with: |
| 133 | + node-version: ${{ matrix.node }} |
| 134 | + - id: test |
| 135 | + run: ${{ matrix.cmd }} |
| 136 | + continue-on-error: true |
| 137 | + - name: First retry |
| 138 | + id: retry |
| 139 | + if: steps.test.outcome == 'failure' |
| 140 | + run: ${{ matrix.cmd }} |
| 141 | + continue-on-error: true |
| 142 | + - name: Second retry |
| 143 | + if: steps.retry.outcome == 'failure' |
| 144 | + run: ${{ matrix.cmd }} |
| 145 | + |
| 146 | + # Run the integration, find and mapreduce tests against all the browser-based |
| 147 | + # adapters. PouchDB adapters. This should be run for every adapter on every |
| 148 | + # target browser. |
| 149 | + |
| 150 | + browser-adapter: |
| 151 | + needs: lint |
| 152 | + strategy: |
| 153 | + fail-fast: false |
| 154 | + matrix: |
| 155 | + client: ['firefox', 'chromium'] |
| 156 | + adapter: ['idb', 'indexeddb', 'memory'] |
| 157 | + cmd: |
| 158 | + - npm test |
| 159 | + - TYPE=find PLUGINS=pouchdb-find npm test |
| 160 | + - TYPE=mapreduce npm test |
| 161 | + runs-on: ubuntu-latest |
| 162 | + env: |
| 163 | + POUCHDB_SRC: ../../packages/node_modules/pouchdb/dist/pouchdb.min.js |
| 164 | + CLIENT: ${{ matrix.client }} |
| 165 | + ADAPTERS: ${{ matrix.adapter }} |
| 166 | + steps: |
| 167 | + - uses: actions/checkout@v3 |
| 168 | + - uses: ./.github/actions/install-deps |
| 169 | + with: |
| 170 | + node-version: ${{ env.NODE_VERSION }} |
| 171 | + - id: test |
| 172 | + run: ${{ matrix.cmd }} |
| 173 | + continue-on-error: true |
| 174 | + - name: First retry |
| 175 | + id: retry |
| 176 | + if: steps.test.outcome == 'failure' |
| 177 | + run: ${{ matrix.cmd }} |
| 178 | + continue-on-error: true |
| 179 | + - name: Second retry |
| 180 | + if: steps.retry.outcome == 'failure' |
| 181 | + run: ${{ matrix.cmd }} |
| 182 | + |
| 183 | + # Run the integration, find and mapreduce tests using pouchdb-server as the |
| 184 | + # remote adapter. This checks that pouchdb-server works with the current |
| 185 | + # PouchDB source tree. We run this on Node.js and on every target browser. |
| 186 | + # Running against different versions of Node.js might require splitting this |
| 187 | + # out into a distinct job. |
| 188 | + |
| 189 | + pouchdb-server: |
| 190 | + needs: lint |
| 191 | + strategy: |
| 192 | + fail-fast: false |
| 193 | + matrix: |
| 194 | + client: ['node', 'firefox', 'chromium'] |
| 195 | + cmd: |
| 196 | + - npm test |
| 197 | + - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test |
| 198 | + - TYPE=mapreduce ADAPTERS=http npm test |
| 199 | + runs-on: ubuntu-latest |
| 200 | + env: |
| 201 | + CLIENT: ${{ matrix.client }} |
| 202 | + SERVER: pouchdb-server |
| 203 | + steps: |
| 204 | + - uses: actions/checkout@v3 |
| 205 | + - uses: ./.github/actions/install-deps |
| 206 | + with: |
| 207 | + node-version: ${{ env.NODE_VERSION }} |
| 208 | + - id: test |
| 209 | + run: ${{ matrix.cmd }} |
| 210 | + continue-on-error: true |
| 211 | + - name: First retry |
| 212 | + id: retry |
| 213 | + if: steps.test.outcome == 'failure' |
| 214 | + run: ${{ matrix.cmd }} |
| 215 | + continue-on-error: true |
| 216 | + - name: Second retry |
| 217 | + if: steps.retry.outcome == 'failure' |
| 218 | + run: ${{ matrix.cmd }} |
| 219 | + |
| 220 | + # Run all the other testing tasks -- unit tests, and so on. These should be |
| 221 | + # run on every version of Node.js that we support. |
| 222 | + |
| 223 | + nodejs: |
| 224 | + needs: lint |
| 225 | + strategy: |
| 226 | + fail-fast: false |
| 227 | + matrix: |
| 228 | + node: [14, 16] |
| 229 | + cmd: |
| 230 | + - CLIENT=firefox npm run test-webpack |
| 231 | + - AUTO_COMPACTION=true npm test |
| 232 | + - PERF=1 npm test |
| 233 | + - npm run test-unit |
| 234 | + - npm run test-component |
| 235 | + - npm run test-fuzzy |
| 236 | + # - SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find npm run report-coverage |
| 237 | + - npm run verify-build |
| 238 | + runs-on: ubuntu-latest |
| 239 | + steps: |
| 240 | + - uses: actions/checkout@v3 |
| 241 | + - uses: ./.github/actions/install-deps |
| 242 | + with: |
| 243 | + node-version: ${{ matrix.node }} |
| 244 | + - id: test |
| 245 | + run: ${{ matrix.cmd }} |
| 246 | + continue-on-error: true |
| 247 | + - name: First retry |
| 248 | + id: retry |
| 249 | + if: steps.test.outcome == 'failure' |
| 250 | + run: git reset --hard && ${{ matrix.cmd }} |
| 251 | + continue-on-error: true |
| 252 | + - name: Second retry |
| 253 | + if: steps.retry.outcome == 'failure' |
| 254 | + run: git reset --hard && ${{ matrix.cmd }} |
0 commit comments