|
| 1 | +name: "CI" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ci-${{ github.head_ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + commits: |
| 14 | + name: "Commits" |
| 15 | + if: ${{ github.event_name == 'pull_request' }} |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: "Checkout code" |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + ref: ${{ github.event.pull_request.head.sha }} |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: "Check commits of the PR branch" |
| 25 | + run: ./.github/check_commits.sh |
| 26 | + |
| 27 | + linters: |
| 28 | + name: "Linters" |
| 29 | + needs: commits |
| 30 | + if: ${{ !failure() }} |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: "Checkout code" |
| 34 | + uses: actions/checkout@v2 |
| 35 | + |
| 36 | + - name: "Set up Node" |
| 37 | + uses: actions/setup-node@v2 |
| 38 | + with: |
| 39 | + node-version: '12' |
| 40 | + cache: 'yarn' |
| 41 | + |
| 42 | + - name: "Install dependencies" |
| 43 | + run: yarn install --frozen-lockfile |
| 44 | + |
| 45 | + - name: "Run linters" |
| 46 | + run: yarn lint |
| 47 | + |
| 48 | + build: |
| 49 | + name: "Build" |
| 50 | + needs: commits |
| 51 | + if: ${{ !failure() }} |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: "Checkout code" |
| 55 | + uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - name: "Set up Node" |
| 58 | + uses: actions/setup-node@v2 |
| 59 | + with: |
| 60 | + node-version: '12' |
| 61 | + cache: 'yarn' |
| 62 | + |
| 63 | + - name: "Install dependencies" |
| 64 | + run: yarn install --frozen-lockfile |
| 65 | + |
| 66 | + - name: "Build the sources" |
| 67 | + run: yarn build |
| 68 | + |
| 69 | + tests: |
| 70 | + name: "Tests" |
| 71 | + if: ${{ !failure() }} |
| 72 | + needs: [linters, build] |
| 73 | + strategy: |
| 74 | + fail-fast: true |
| 75 | + matrix: |
| 76 | + node-version: ['12', '14', '16', '17'] |
| 77 | + |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - name: "Checkout code" |
| 81 | + uses: actions/checkout@v2 |
| 82 | + |
| 83 | + - name: "Set up Node ${{ matrix.node-version }}" |
| 84 | + uses: actions/setup-node@v2 |
| 85 | + with: |
| 86 | + node-version: ${{ matrix.node-version }} |
| 87 | + cache: 'yarn' |
| 88 | + |
| 89 | + - name: "Install dependencies" |
| 90 | + run: yarn install --frozen-lockfile |
| 91 | + |
| 92 | + - name: "Run type-checking" |
| 93 | + run: yarn type-check |
| 94 | + |
| 95 | + - name: "Run tests" |
| 96 | + run: yarn test:cov |
| 97 | + |
| 98 | + - name: "Upload coverage" |
| 99 | + if: matrix.node-version == '12' |
| 100 | + uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 |
0 commit comments