|
| 1 | + |
| 2 | +name: Checks |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + |
| 10 | +env: |
| 11 | + NODE_VERSION: 14 |
| 12 | + |
| 13 | +jobs: |
| 14 | + tests: |
| 15 | + name: Unit tests |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v1 |
| 24 | + with: |
| 25 | + node-version: ${{ env.NODE_VERSION }} |
| 26 | + |
| 27 | + - name: Cache node_modules |
| 28 | + uses: actions/cache@v2 |
| 29 | + id: cache-nodemodules |
| 30 | + with: |
| 31 | + path: node_modules |
| 32 | + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 36 | + run: yarn install --frozen-lockfile --non-interactive |
| 37 | + |
| 38 | + - name: Unit tests |
| 39 | + run: yarn test --ci |
| 40 | + |
| 41 | + lint: |
| 42 | + name: Lint |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v2 |
| 48 | + |
| 49 | + - name: Setup Node.js |
| 50 | + uses: actions/setup-node@v1 |
| 51 | + with: |
| 52 | + node-version: ${{ env.NODE_VERSION }} |
| 53 | + |
| 54 | + - name: Cache node_modules |
| 55 | + uses: actions/cache@v2 |
| 56 | + id: cache-nodemodules |
| 57 | + with: |
| 58 | + path: node_modules |
| 59 | + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} |
| 60 | + |
| 61 | + - name: Install dependencies |
| 62 | + if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 63 | + run: yarn install --frozen-lockfile --non-interactive |
| 64 | + |
| 65 | + - name: Lint |
| 66 | + run: yarn lint |
| 67 | + |
| 68 | + website: |
| 69 | + name: Test build website |
| 70 | + if: ${{ github.event.issue.pull_request }} |
| 71 | + runs-on: ubuntu-latest |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@v2 |
| 76 | + |
| 77 | + - name: Setup Node.js |
| 78 | + uses: actions/setup-node@v1 |
| 79 | + with: |
| 80 | + node-version: ${{ env.NODE_VERSION }} |
| 81 | + |
| 82 | + - name: Cache node_modules |
| 83 | + uses: actions/cache@v2 |
| 84 | + id: cache-nodemodules |
| 85 | + with: |
| 86 | + path: node_modules |
| 87 | + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} |
| 88 | + |
| 89 | + - name: Install dependencies |
| 90 | + if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 91 | + run: yarn install --frozen-lockfile --non-interactive |
| 92 | + |
| 93 | + - name: Build website |
| 94 | + run: yarn website |
| 95 | + |
| 96 | + release: |
| 97 | + needs: [tests, lint] |
| 98 | + if: github.ref == 'refs/heads/main' |
| 99 | + name: Release |
| 100 | + runs-on: ubuntu-latest |
| 101 | + |
| 102 | + steps: |
| 103 | + - name: Checkout |
| 104 | + uses: actions/checkout@v2 |
| 105 | + with: |
| 106 | + fetch-depth: 0 |
| 107 | + |
| 108 | + - name: Setup Node.js |
| 109 | + uses: actions/setup-node@v1 |
| 110 | + with: |
| 111 | + node-version: ${{ env.NODE_VERSION }} |
| 112 | + |
| 113 | + - name: Cache node_modules |
| 114 | + uses: actions/cache@v2 |
| 115 | + id: cache-nodemodules |
| 116 | + with: |
| 117 | + path: node_modules |
| 118 | + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} |
| 119 | + |
| 120 | + - name: Install dependencies |
| 121 | + if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 122 | + run: yarn install --frozen-lockfile --non-interactive |
| 123 | + |
| 124 | + - name: Release |
| 125 | + run: yarn release |
| 126 | + env: |
| 127 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 128 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 129 | + |
| 130 | + deploy: |
| 131 | + name: Deploy website |
| 132 | + needs: [tests, lint] |
| 133 | + if: github.ref == 'refs/heads/main' |
| 134 | + runs-on: ubuntu-latest |
| 135 | + steps: |
| 136 | + - name: Checkout |
| 137 | + uses: actions/checkout@v2 |
| 138 | + |
| 139 | + - name: Setup Node.js |
| 140 | + uses: actions/setup-node@v1 |
| 141 | + with: |
| 142 | + node-version: ${{ env.NODE_VERSION }} |
| 143 | + |
| 144 | + - name: Cache node_modules |
| 145 | + uses: actions/cache@v2 |
| 146 | + id: cache-nodemodules |
| 147 | + with: |
| 148 | + path: node_modules |
| 149 | + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} |
| 150 | + |
| 151 | + - name: Install dependencies |
| 152 | + if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 153 | + run: yarn install --frozen-lockfile --non-interactive |
| 154 | + |
| 155 | + - name: Build |
| 156 | + run: yarn website |
| 157 | + |
| 158 | + - name: Deploy |
| 159 | + |
| 160 | + with: |
| 161 | + branch: gh-pages |
| 162 | + folder: examples/dist |
0 commit comments