CI #1085
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: [master] | |
pull_request: | |
branches: [master] | |
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: ./coverage/coverage-final.json | |
fail_ci_if_error: true | |
docs: | |
name: Update docs | |
needs: [tests] | |
if: github.ref == 'refs/heads/master' | |
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: Generate storybook documentation | |
run: yarn build:storybook | |
- 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] | |
if: github.ref == 'refs/heads/master' | |
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 }} |