|
| 1 | +name: CI |
| 2 | +on: [push, pull_request] |
| 3 | +env: |
| 4 | + NODE_VERSION_USED_FOR_DEVELOPMENT: 14 |
| 5 | +jobs: |
| 6 | + lint: |
| 7 | + name: Lint source files |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout repo |
| 11 | + uses: actions/checkout@v2 |
| 12 | + |
| 13 | + - name: Setup Node.js |
| 14 | + uses: actions/setup-node@v1 |
| 15 | + with: |
| 16 | + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} |
| 17 | + |
| 18 | + - name: Cache Node.js modules |
| 19 | + uses: actions/cache@v2 |
| 20 | + with: |
| 21 | + path: ~/.npm |
| 22 | + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} |
| 23 | + restore-keys: | |
| 24 | + ${{ runner.OS }}-node- |
| 25 | +
|
| 26 | + - name: Install Dependencies |
| 27 | + run: npm ci |
| 28 | + |
| 29 | + - name: Lint Prettier |
| 30 | + run: npm run prettier:check |
| 31 | + |
| 32 | + - name: Lint ESLint |
| 33 | + run: npm run lint |
| 34 | + |
| 35 | + - name: Lint Flow |
| 36 | + run: npm run check |
| 37 | + |
| 38 | + coverage: |
| 39 | + name: Measure test coverage |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout repo |
| 43 | + uses: actions/checkout@v2 |
| 44 | + |
| 45 | + - name: Setup Node.js |
| 46 | + uses: actions/setup-node@v1 |
| 47 | + with: |
| 48 | + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} |
| 49 | + |
| 50 | + - name: Cache Node.js modules |
| 51 | + uses: actions/cache@v2 |
| 52 | + with: |
| 53 | + path: ~/.npm |
| 54 | + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.OS }}-node- |
| 57 | +
|
| 58 | + - name: Install Dependencies |
| 59 | + run: npm ci |
| 60 | + |
| 61 | + - name: Run tests and measure code coverage |
| 62 | + run: npm run testonly:cover |
| 63 | + |
| 64 | + - name: Upload coverage to Coveralls |
| 65 | + if: ${{ always() }} |
| 66 | + run: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js |
| 67 | + |
| 68 | + test: |
| 69 | + name: Run tests on Node v${{ matrix.node_version_to_setup }} |
| 70 | + runs-on: ubuntu-latest |
| 71 | + strategy: |
| 72 | + matrix: |
| 73 | + node_version_to_setup: [10, 12, 14] |
| 74 | + steps: |
| 75 | + - name: Checkout repo |
| 76 | + uses: actions/checkout@v2 |
| 77 | + |
| 78 | + - name: Setup Node.js v${{ matrix.node_version_to_setup }} |
| 79 | + uses: actions/setup-node@v1 |
| 80 | + with: |
| 81 | + node-version: ${{ matrix.node_version_to_setup }} |
| 82 | + |
| 83 | + - name: Cache Node.js modules |
| 84 | + uses: actions/cache@v2 |
| 85 | + with: |
| 86 | + path: ~/.npm |
| 87 | + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} |
| 88 | + restore-keys: | |
| 89 | + ${{ runner.OS }}-node- |
| 90 | +
|
| 91 | + - name: Install Dependencies |
| 92 | + run: npm ci |
| 93 | + |
| 94 | + - name: Run Tests |
| 95 | + run: npm run testonly |
0 commit comments