From f191ca3bdc8a8b3aff36da32c1fc28fb3eee8bca Mon Sep 17 00:00:00 2001 From: graykode Date: Tue, 2 Apr 2024 15:28:02 +0900 Subject: [PATCH] ci: run default ci --- .github/workflows/ci.yaml | 81 +++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..451f3a6 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,81 @@ +name: Clober DEX CI +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + tests: + name: NPM Test + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [ '18.10' ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Install Dependencies + run: npm ci + - name: Run test + run: npm run test + + check-lint: + name: Check TS + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [ '18.10' ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Install Dependencies + run: npm ci + - name: Check Ts Style + run: npm run lint diff --git a/package.json b/package.json index a15ebe0..778f624 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "url": "git+https://github.com/clober-dex/v2-sdk.git" }, "scripts": { + "lint": "eslint --ext .ts src --fix", "docs": "typedoc --out docs src/index.ts --sort source-order", "test": "vitest --root test --config vitest.config.ts", "clean": "rm -rf dist && rm -rf src/.graphclient",