|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [ push, pull_request ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + lockfile-lint: |
| 7 | + name: Lockfile lint |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v2 |
| 11 | + - uses: actions/setup-node@v2 |
| 12 | + with: |
| 13 | + node-version: '14' |
| 14 | + - name: lint lock file |
| 15 | + run: npx lockfile-lint --path package-lock.json --allowed-hosts npm --validate-https |
| 16 | + |
| 17 | + test: |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + platform: [ ubuntu-latest ] |
| 21 | + node: [ '10', '12', '14', '16' ] |
| 22 | + needs: lockfile-lint |
| 23 | + name: Unit Tests Node ${{ matrix.node }} (${{ matrix.platform }}) |
| 24 | + runs-on: ${{ matrix.platform }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + - uses: actions/setup-node@v2 |
| 28 | + with: |
| 29 | + node-version: ${{ matrix.node }} |
| 30 | + - uses: actions/cache@v2 |
| 31 | + with: |
| 32 | + path: '**/node_modules' |
| 33 | + key: ${{ matrix.node }}-node-${{ hashFiles('**/package-lock.json') }} |
| 34 | + - name: install dependencies |
| 35 | + if: steps.cache.outputs.cache-hit != 'true' |
| 36 | + run: npm ci |
| 37 | + - name: Units Tests + Prepare Coveralls |
| 38 | + run: npm run test:ci |
| 39 | + - name: Coveralls |
| 40 | + uses: coverallsapp/github-action@master |
| 41 | + if: matrix.node == '14' |
| 42 | + with: |
| 43 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + release: |
| 46 | + name: release |
| 47 | + needs: [ test, lockfile-lint ] |
| 48 | + runs-on: 'ubuntu-latest' |
| 49 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + - uses: actions/setup-node@v2 |
| 53 | + with: |
| 54 | + node-version: '14' |
| 55 | + - name: install dependencies |
| 56 | + run: npm ci --ignore-scripts |
| 57 | + - name: release |
| 58 | + run: npx semantic-release |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 61 | + NPM_TOKEN: ${{secrets.NPM_TOKEN}} |
0 commit comments