|
| 1 | +# This workflow will do a clean install of node dependencies, and run the linter |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 3 | + |
| 4 | +name: Node.js CI |
| 5 | + |
| 6 | +on: |
| 7 | + # Any additional branches here will currently be treated as release (or maintenance) branches. |
| 8 | + # if the need to run jobs on other branches emerges, then the release job will need a better |
| 9 | + # condition expression. |
| 10 | + push: |
| 11 | + branches: master |
| 12 | + pull_request: |
| 13 | + branches: master |
| 14 | + |
| 15 | +jobs: |
| 16 | + lint: |
| 17 | + # https://github.community/t/github-actions-does-not-respect-skip-ci/17325/9 |
| 18 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + services: |
| 22 | + redis: |
| 23 | + image: redis |
| 24 | + ports: |
| 25 | + - 6379:6379 |
| 26 | + options: >- |
| 27 | + --health-cmd "redis-cli ping" |
| 28 | + --health-interval 10s |
| 29 | + --health-timeout 5s |
| 30 | + --health-retries 5 |
| 31 | +
|
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + node-version: [4.0.x, 8.x, 10.x, 12.x, 14.x] |
| 35 | + include: |
| 36 | + - node-version: 14.x |
| 37 | + report-coverage: true |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v2 |
| 41 | + with: |
| 42 | + # For commitlint; ideally this would only check out the feature branch's history, but |
| 43 | + # that's not currently an option. |
| 44 | + fetch-depth: ${{ github.event_name == 'push' }} |
| 45 | + - name: Cache dependencies |
| 46 | + id: cache |
| 47 | + uses: actions/cache@v2 |
| 48 | + with: |
| 49 | + path: node_modules |
| 50 | + key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }} |
| 51 | + - name: Use Node.js 14 for dependencies |
| 52 | + uses: actions/setup-node@v1 |
| 53 | + if: '!steps.cache.outputs.cache-hit' |
| 54 | + with: |
| 55 | + node-version: 14.x |
| 56 | + - name: Install dependencies |
| 57 | + if: '!steps.cache.outputs.cache-hit' |
| 58 | + run: npm ci |
| 59 | + - name: Use Node.js ${{ matrix.node-version }} |
| 60 | + uses: actions/setup-node@v1 |
| 61 | + with: |
| 62 | + node-version: ${{ matrix.node-version }} |
| 63 | + - run: npm run ci --if-present |
| 64 | + env: |
| 65 | + BEE_QUEUE_TEST_REDIS: redis://localhost:6379 |
| 66 | + GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }} |
| 67 | + - name: Report to Coveralls |
| 68 | + uses: coverallsapp/github-action@master |
| 69 | + if: matrix.report-coverage |
| 70 | + with: |
| 71 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments