|
| 1 | +name: Node.js CI |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + - uses: actions/setup-node@v1 |
| 11 | + with: |
| 12 | + node-version: "12.14.1" |
| 13 | + - uses: actions/cache@v1 |
| 14 | + with: |
| 15 | + path: ~/.npm |
| 16 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 17 | + restore-keys: | |
| 18 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 19 | + ${{ runner.os }}-build- |
| 20 | + ${{ runner.os }}- |
| 21 | + - run: npm ci |
| 22 | + - name: eslint |
| 23 | + run: npx eslint . |
| 24 | + - name: test |
| 25 | + run: npm test |
| 26 | + env: |
| 27 | + CI: true |
| 28 | + - uses: actions/upload-artifact@v1 |
| 29 | + with: |
| 30 | + name: coverage |
| 31 | + path: .nyc_output |
| 32 | + coverage: |
| 33 | + needs: test |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v2 |
| 37 | + - uses: actions/setup-node@v1 |
| 38 | + with: |
| 39 | + node-version: "12.14.1" |
| 40 | + - uses: actions/cache@v1 |
| 41 | + with: |
| 42 | + path: ~/.npm |
| 43 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 46 | + ${{ runner.os }}-build- |
| 47 | + ${{ runner.os }}- |
| 48 | + - run: npm ci |
| 49 | + - uses: actions/download-artifact@v1 |
| 50 | + with: |
| 51 | + name: coverage |
| 52 | + path: .nyc_output |
| 53 | + - name: coverage |
| 54 | + run: | |
| 55 | + npm i -g coveralls |
| 56 | + npx nyc check-coverage |
| 57 | + npx nyc report > lcov.info |
| 58 | + coveralls < lcov.info |
| 59 | + env: |
| 60 | + CI: true |
| 61 | + COVERALLS_REPO_TOKEN: ${{ secrets. COVERALLS_REPO_TOKEN }} |
| 62 | + release: |
| 63 | + if: github.ref == 'refs/heads/master' |
| 64 | + needs: coverage |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v2 |
| 68 | + - uses: actions/setup-node@v1 |
| 69 | + with: |
| 70 | + node-version: "12.14.1" |
| 71 | + - uses: actions/cache@v1 |
| 72 | + with: |
| 73 | + path: ~/.npm |
| 74 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 75 | + restore-keys: | |
| 76 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 77 | + ${{ runner.os }}-build- |
| 78 | + ${{ runner.os }}- |
| 79 | + - run: npm ci |
| 80 | + - run: npx semantic-release |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments