Merge pull request #102 from gadingnst/v2.2.0 #218
This file contains 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: Continuous Integration | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
install: | |
name: Install Dependency | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- name: Cache node modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.event.pull_request.head.sha }} | |
restore-keys: | | |
node_modules- | |
- name: Install Dependency Package | |
run: | | |
npm install | |
test: | |
name: Unit Test | |
if: github.event_name == 'pull_request' | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Load node_modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.event.pull_request.head.sha }} | |
- name: Start Unit Testing | |
run: | | |
npm run test:coverage | |
- name: Generate Coverage Report | |
uses: ArtiomTr/jest-coverage-report-action@v2 | |
with: | |
package-manager: npm | |
skip-step: all | |
coverage-file: packages/swr-global-state/report.json | |
base-coverage-file: packages/swr-global-state/report.json | |
build: | |
name: Build | |
if: github.event_name == 'push' | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Load node_modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.event.pull_request.head.sha }} | |
- name: Start Building | |
run: | | |
npm run build | |
size: | |
name: Build & Generate Size report | |
if: github.event_name == 'pull_request' | |
needs: install | |
runs-on: ubuntu-latest | |
env: | |
CI_JOB_NUMBER: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Load node_modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.event.pull_request.head.sha }} | |
- uses: andresz1/size-limit-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
skip_step: install | |
directory: packages/swr-global-state |