|
| 1 | +name: Node.js CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + test-node: |
| 13 | + name: Test on Node.js v${{ matrix.node-version }} |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 15.x] |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + - name: Get yarn cache directory path |
| 25 | + id: yarn-cache-dir-path |
| 26 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 27 | + - uses: actions/cache@v2 |
| 28 | + id: yarn-cache |
| 29 | + with: |
| 30 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 31 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-yarn- |
| 34 | + - name: Use Node.js ${{ matrix.node-version }} |
| 35 | + uses: actions/setup-node@v2 |
| 36 | + with: |
| 37 | + node-version: ${{ matrix.node-version }} |
| 38 | + - run: yarn |
| 39 | + - name: run tests |
| 40 | + run: yarn travis |
| 41 | + - uses: codecov/codecov-action@v1 |
| 42 | + test-os: |
| 43 | + name: Test on ${{ matrix.os }} using Node.js LTS |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + os: [ubuntu-latest, windows-latest, macOS-latest] |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + - name: Get yarn cache directory path |
| 53 | + id: yarn-cache-dir-path |
| 54 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 55 | + - uses: actions/cache@v2 |
| 56 | + id: yarn-cache |
| 57 | + with: |
| 58 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 59 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 60 | + restore-keys: | |
| 61 | + ${{ runner.os }}-yarn- |
| 62 | + |
| 63 | + with: |
| 64 | + node-version: 14.x |
| 65 | + - run: yarn |
| 66 | + - name: run tests |
| 67 | + run: yarn travis |
| 68 | + |
| 69 | + release: |
| 70 | + if: |
| 71 | + # prettier-ignore |
| 72 | + ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} |
| 73 | + name: Release new version |
| 74 | + needs: [test-node, test-os] |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v2 |
| 78 | + with: |
| 79 | + fetch-depth: 0 |
| 80 | + - name: Get yarn cache directory path |
| 81 | + id: yarn-cache-dir-path |
| 82 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 83 | + - uses: actions/cache@v2 |
| 84 | + id: yarn-cache |
| 85 | + with: |
| 86 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 87 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 88 | + restore-keys: | |
| 89 | + ${{ runner.os }}-yarn- |
| 90 | + - uses: actions/setup-node@v2 |
| 91 | + with: |
| 92 | + node-version: 14.x |
| 93 | + - name: install |
| 94 | + run: yarn |
| 95 | + - run: npx semantic-release@15 |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments