diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2d401ae7..18f30fd4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,38 +2,79 @@ name: CI on: [push] +env: + NODE_VERSION: 12.x + jobs: - build: + install: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [10.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: CI + uses: actions/checkout@v2 + - name: Use Node ${{ env.NODE_VERSION }} uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} - - name: install dependencies - run: | - yarn - - name: run lint - run: | - yarn lint - - name: run tests - run: | - yarn test --watchAll=false --coverage --reporters=default + node-version: ${{ env.NODE_VERSION }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies + run: yarn install --frozen-lockfile + env: + CI: true + + lint: + runs-on: ubuntu-latest + needs: [install] + + steps: + - name: Running lint + uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Lint + run: yarn lint + env: + CI: true + + test: + runs-on: ubuntu-latest + needs: [install] + + steps: + - name: Running tests + uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Test + run: yarn test --coverage --reporters=default - name: Upload coverage to Codecov uses: codecov/codecov-action@v1.4.1 with: token: ${{ secrets.CODECOV_TOKEN }} - - name: build - run: | - yarn build + env: + CI: true - - name: semantic release + build: + runs-on: ubuntu-latest + needs: [install] + + steps: + - name: Build + uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Build + run: yarn build + - name: Release uses: cycjimmy/semantic-release-action@v2 id: semantic with: