From 3a030b3af15f9cf14846590843249ce325e693bc Mon Sep 17 00:00:00 2001 From: Caspian Zhao Date: Fri, 4 Oct 2024 22:03:58 +0800 Subject: [PATCH] Update development workflow (#690) * ci: add new CI job for testing * chore: remove unused linting before commit * ci: update testing CI * ci: update yarn caching logic * ci: refacor dependency caching logic in ci files --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 25 ++++++++----------------- .github/workflows/static.yml | 24 ++++++++++-------------- package.json | 3 +-- 4 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..fd127692 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Run tests + run: yarn test + + - name: Run linter + run: yarn lint + + - name: Check types + run: yarn types \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31bb4939..73427de1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,31 +11,22 @@ jobs: timeout-minutes: 15 runs-on: ubuntu-latest steps: - - name: checkout code repository + - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - - name: setup node.js + - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 18.x + cache: yarn - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v1 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: install dependencies - run: yarn install && yarn clean && yarn prepare + - name: Install dependencies + run: yarn install + - name: build + run: yarn prepare - name: Create Release Pull Request or Publish to npm id: changesets diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e4277e4d..afc4e5e9 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -31,27 +31,23 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup Pages uses: actions/configure-pages@v3 - - uses: actions/setup-node@v3 + - name: Setup Node + uses: actions/setup-node@v3 with: - node-version: '18.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" + node-version: 18.x + cache: yarn - - uses: actions/cache@v1 - 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: Install dependencies + run: yarn install - - run: yarn install && yarn clean && yarn prepare + - name: build + run: yarn prepare - run: cd ./example/app && yarn install && yarn build:web diff --git a/package.json b/package.json index 773ac2a3..666f1046 100644 --- a/package.json +++ b/package.json @@ -93,8 +93,7 @@ }, "husky": { "hooks": { - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "pre-commit": "yarn test && yarn lint && yarn types" + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } }, "commitlint": {