Skip to content

Commit

Permalink
ci: setup github action
Browse files Browse the repository at this point in the history
  • Loading branch information
moontai0724 authored and a20688392 committed Jan 6, 2023
1 parent 408cb06 commit 44ff011
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Continuous Integration

on: pull_request

jobs:
lint-check:
name: Lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup node and cache dependencies
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"

- name: Install Dependencies
run: yarn install

- name: ESLint Check
run: yarn eslint "./**/*.ts"

- name: Prettier Check
run: yarn prettier --check .

unit-test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup node and cache dependencies
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Unit Test
run: yarn test

0 comments on commit 44ff011

Please sign in to comment.