|
1 | | -name: test |
2 | | -on: |
3 | | - push: |
4 | | - branches: [ main ] |
5 | 1 | jobs: |
6 | | - npm-test: |
| 2 | + build: |
| 3 | + continue-on-error: true |
| 4 | + name: Build on Node.js ${{ matrix.node }} |
| 5 | + outputs: |
| 6 | + result: ${{ steps.build.outputs.result }} |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + node: |
| 12 | + - '14.17.5' |
| 13 | + - '16.13.1' |
| 14 | + - '17.2.0' |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + fetch-depth: 1 |
| 20 | + - name: Setup Node.js |
| 21 | + uses: actions/setup-node@v2 |
| 22 | + with: |
| 23 | + node-version: ${{ matrix.node }} |
| 24 | + - name: Setup modules |
| 25 | + run: npm install |
| 26 | + - name: Build |
| 27 | + id: build |
| 28 | + run: npm run build && echo "::set-output name=result::success" |
| 29 | + coverage: |
| 30 | + continue-on-error: true |
| 31 | + name: Check code coverages on Node.js ${{ matrix.node }} |
| 32 | + outputs: |
| 33 | + result: ${{ steps.coverage.outputs.result }} |
| 34 | + runs-on: ubuntu-latest |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + node: |
| 39 | + - '14.17.5' |
| 40 | + - '16.13.1' |
| 41 | + - '17.2.0' |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v2 |
| 45 | + with: |
| 46 | + fetch-depth: 1 |
| 47 | + - name: Setup Node.js |
| 48 | + uses: actions/setup-node@v2 |
| 49 | + with: |
| 50 | + node-version: ${{ matrix.node }} |
| 51 | + - name: Setup modules |
| 52 | + run: npm install |
| 53 | + - name: Check code coverages |
| 54 | + id: coverage |
| 55 | + run: npm test && echo "::set-output name=result::success" |
| 56 | + - name: Archive code coverage report |
| 57 | + if: ${{ always() }} |
| 58 | + uses: actions/upload-artifact@v2 |
| 59 | + with: |
| 60 | + name: code-coverage-report-${{ matrix.node }} |
| 61 | + path: coverage |
| 62 | + example: |
| 63 | + continue-on-error: true |
| 64 | + name: Run an example on Node.js ${{ matrix.node }} |
| 65 | + outputs: |
| 66 | + result: ${{ steps.example.outputs.result }} |
7 | 67 | runs-on: ubuntu-latest |
8 | 68 | strategy: |
| 69 | + fail-fast: false |
9 | 70 | matrix: |
10 | | - node: [ '14.17.5', '16.8.0' ] |
11 | | - name: Test on Node.js ${{ matrix.node }} |
| 71 | + node: |
| 72 | + - '14.17.5' |
| 73 | + - '16.13.1' |
| 74 | + - '17.2.0' |
12 | 75 | steps: |
13 | | - - uses: actions/checkout@v2 |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v2 |
| 78 | + with: |
| 79 | + fetch-depth: 1 |
14 | 80 | - name: Setup Node.js |
15 | 81 | uses: actions/setup-node@v2 |
16 | 82 | with: |
17 | 83 | node-version: ${{ matrix.node }} |
18 | 84 | - name: Setup modules |
19 | | - run: npm i |
20 | | - - name: Test |
21 | | - run: npm test |
| 85 | + run: npm install |
| 86 | + - name: Run an example |
| 87 | + id: example |
| 88 | + run: npm start && echo "::set-output name=result::success" |
| 89 | + test: |
| 90 | + name: Aggregate results |
| 91 | + needs: |
| 92 | + - build |
| 93 | + - coverage |
| 94 | + - example |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - name: Check build result |
| 98 | + run: test "${{ needs.build.outputs.result }}" = "success" || { echo "\x1b[31mFailed to build\x1b[m"; exit 1; } |
| 99 | + - name: Check code coverages result |
| 100 | + run: test "${{ needs.coverage.outputs.result }}" = "success" || { echo "\x1b[31mFailed to check code coverages\x1b[m"; exit 1; } |
| 101 | + - name: Check example result |
| 102 | + run: test "${{ needs.example.outputs.result }}" = "success" || { echo "\x1b[31mFailed to run an example\x1b[m"; exit 1; } |
| 103 | +name: test |
| 104 | +on: |
| 105 | + pull_request: |
| 106 | + branches: |
| 107 | + - devel |
| 108 | + - main |
| 109 | + - release |
| 110 | + push: |
| 111 | + branches: |
| 112 | + - devel |
| 113 | + - main |
| 114 | + - release |
0 commit comments