CI #1254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| NODE_VERSION: 14 | |
| jobs: | |
| tests: | |
| name: Unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v3 | |
| id: cache-nodemodules | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile --non-interactive | |
| - name: Unit tests | |
| run: yarn test --ci --coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v2 | |
| with: | |
| files: ./src/coverage/coverage-final.json | |
| fail_ci_if_error: true | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v3 | |
| id: cache-nodemodules | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile --non-interactive | |
| - name: Lint | |
| run: yarn lint | |
| docs: | |
| needs: [tests, lint] | |
| if: github.ref == 'refs/heads/main' | |
| name: Update docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v3 | |
| id: cache-nodemodules | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile --non-interactive | |
| - name: Build latest app | |
| run: yarn build | |
| - name: Generate storybook documentation | |
| run: yarn build:storybook | |
| - name: Deploy storybook documentation to gh-pages | |
| uses: JamesIves/[email protected] | |
| with: | |
| branch: gh-pages # The branch the action should deploy to. | |
| folder: .docs # The folder the action should deploy. | |
| release: | |
| needs: [tests, lint, docs] | |
| if: github.ref == 'refs/heads/main' | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v3 | |
| id: cache-nodemodules | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile --non-interactive | |
| - name: Release | |
| run: yarn release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |