|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + style: |
| 7 | + name: Style |
| 8 | + runs-on: ubuntu-18.04 |
| 9 | + steps: |
| 10 | + - name: Checkout |
| 11 | + uses: actions/checkout@v1 |
| 12 | + |
| 13 | + - name: Setup Node.js |
| 14 | + uses: actions/setup-node@v1 |
| 15 | + with: |
| 16 | + node-version: 12 |
| 17 | + |
| 18 | + - name: Get yarn cache |
| 19 | + id: yarn-cache |
| 20 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 21 | + |
| 22 | + - uses: actions/cache@v1 |
| 23 | + with: |
| 24 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 25 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 26 | + restore-keys: | |
| 27 | + ${{ runner.os }}-yarn- |
| 28 | +
|
| 29 | + - name: Install dependencies |
| 30 | + run: yarn install |
| 31 | + |
| 32 | + - name: Build |
| 33 | + run: yarn build |
| 34 | + |
| 35 | + - name: Lint commit messages |
| 36 | + run: yarn commitlint |
| 37 | + |
| 38 | + - name: Lint files with eslint |
| 39 | + run: yarn lint |
| 40 | + |
| 41 | + - name: Check formatting with prettier |
| 42 | + run: yarn prettier |
| 43 | + |
| 44 | + test: |
| 45 | + name: Test |
| 46 | + runs-on: ubuntu-18.04 |
| 47 | + strategy: |
| 48 | + matrix: |
| 49 | + node: [10, 12] |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v1 |
| 53 | + |
| 54 | + - name: Setup Node.js |
| 55 | + uses: actions/setup-node@v1 |
| 56 | + with: |
| 57 | + node-version: ${{matrix.node}} |
| 58 | + |
| 59 | + - name: Get yarn cache |
| 60 | + id: yarn-cache |
| 61 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 62 | + |
| 63 | + - uses: actions/cache@v1 |
| 64 | + with: |
| 65 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 66 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 67 | + restore-keys: | |
| 68 | + ${{ runner.os }}-yarn- |
| 69 | +
|
| 70 | + - name: Install dependencies |
| 71 | + run: yarn install |
| 72 | + |
| 73 | + - name: Build |
| 74 | + run: yarn build |
| 75 | + |
| 76 | + - name: Run tests |
| 77 | + run: yarn test |
| 78 | + |
| 79 | + - name: Publish code coverage |
| 80 | + |
| 81 | + env: |
| 82 | + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
| 83 | + |
| 84 | + release: |
| 85 | + name: Release |
| 86 | + runs-on: ubuntu-18.04 |
| 87 | + # Only release on master |
| 88 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' |
| 89 | + needs: [style, test] |
| 90 | + steps: |
| 91 | + - name: Checkout |
| 92 | + uses: actions/checkout@v1 |
| 93 | + |
| 94 | + - name: Setup Node.js |
| 95 | + uses: actions/setup-node@v1 |
| 96 | + with: |
| 97 | + node-version: 12 |
| 98 | + |
| 99 | + - name: Get yarn cache |
| 100 | + id: yarn-cache |
| 101 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 102 | + |
| 103 | + - uses: actions/cache@v1 |
| 104 | + with: |
| 105 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 106 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 107 | + restore-keys: | |
| 108 | + ${{ runner.os }}-yarn- |
| 109 | +
|
| 110 | + - name: Install dependencies |
| 111 | + run: yarn install |
| 112 | + |
| 113 | + - name: Build |
| 114 | + run: yarn build |
| 115 | + |
| 116 | + - name: Release |
| 117 | + env: |
| 118 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 120 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 121 | + NPM_CONFIG_REGISTRY: https://npm.pkg.github.com/ |
| 122 | + GIT_AUTHOR_NAME: '@github-actions' |
| 123 | + GIT_AUTHOR_EMAIL: '[email protected]' |
| 124 | + GIT_COMMITTER_NAME: '@github-actions' |
| 125 | + GIT_COMMITTER_EMAIL: '[email protected]' |
| 126 | + run: yarn release |
0 commit comments