|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + tests: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + node-version: [14, 16] |
| 11 | + fail-fast: false |
| 12 | + steps: |
| 13 | + - name: Checkout ${{ matrix.node-version }} |
| 14 | + uses: actions/checkout@v2 |
| 15 | + |
| 16 | + - name: Get yarn cache |
| 17 | + id: yarn-cache |
| 18 | + run: | |
| 19 | + echo "::set-output name=path::$(yarn cache dir)" |
| 20 | + echo "::set-output name=version::$(yarn -v)" |
| 21 | +
|
| 22 | + - name: Setup Node.js ${{ matrix.node }} |
| 23 | + uses: actions/setup-node@v2 |
| 24 | + with: |
| 25 | + node-version: ${{ matrix.node-version }} |
| 26 | + |
| 27 | + - name: Cache dependencies ${{ matrix.node-version }} |
| 28 | + uses: actions/cache@v2 |
| 29 | + env: |
| 30 | + key-prefix: ${{ runner.os }}-node-${{ matrix.node-version }} |
| 31 | + with: |
| 32 | + path: | |
| 33 | + **/node_modules |
| 34 | + **/.eslintcache |
| 35 | + ${{ steps.yarn-cache.outputs.path }} |
| 36 | + key: ${{ env.key-prefix }}-${{ hashFiles('**/yarn.lock') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ env.key-prefix }}- |
| 39 | +
|
| 40 | + - name: Install node_modules |
| 41 | + run: yarn && npx lerna bootstrap |
| 42 | + |
| 43 | + - name: Test – unit tests |
| 44 | + run: yarn test:unit --coverage |
| 45 | + env: |
| 46 | + CI: true |
| 47 | + |
| 48 | + - name: Test – integration |
| 49 | + run: yarn test:integration |
| 50 | + |
| 51 | + - name: Test – Eslint |
| 52 | + if: ${{ always() && matrix.node-version == '14' }} |
| 53 | + run: yarn eslint |
| 54 | + |
| 55 | + - name: Test – TSCheck |
| 56 | + #if: ${{ always() && matrix.node-version == '14' }} |
| 57 | + if: false |
| 58 | + run: yarn tscheck |
| 59 | + |
| 60 | + - name: Publish Test Report |
| 61 | + if: ${{ always() && matrix.node-version == '14' }} |
| 62 | + uses: mikepenz/action-junit-report@v2 |
| 63 | + with: |
| 64 | + check_name: JUnit Annotations for Node ${{ matrix.node-version }} |
| 65 | + report_paths: '**/coverage/*.xml' |
| 66 | + |
| 67 | + - name: Send codecov.io stats |
| 68 | + if: matrix.node-version == '14' |
| 69 | + run: bash <(curl -s https://codecov.io/bash) || echo '' |
| 70 | + |
| 71 | + publish: |
| 72 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta' |
| 73 | + needs: [tests] |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Checkout 14 |
| 77 | + uses: actions/checkout@v2 |
| 78 | + |
| 79 | + - name: Setup Node.js 14 |
| 80 | + uses: actions/setup-node@v2 |
| 81 | + with: |
| 82 | + node-version: 14 |
| 83 | + |
| 84 | + - name: Cache dependencies 14 |
| 85 | + uses: actions/cache@v2 |
| 86 | + env: |
| 87 | + key-prefix: ${{ runner.os }}-node-14 |
| 88 | + with: |
| 89 | + path: | |
| 90 | + **/node_modules |
| 91 | + **/.eslintcache |
| 92 | + ${{ steps.yarn-cache.outputs.path }} |
| 93 | + key: ${{ env.key-prefix }}-${{ hashFiles('**/yarn.lock') }} |
| 94 | + restore-keys: | |
| 95 | + ${{ env.key-prefix }}- |
| 96 | +
|
| 97 | + - name: Install node_modules |
| 98 | + run: yarn |
| 99 | + |
| 100 | + - name: Build |
| 101 | + if: false |
| 102 | + run: yarn build |
| 103 | + |
| 104 | + - name: Semantic Release |
| 105 | + run: yarn release |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 108 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments