diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b731e91..b2630d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ on: - '!docs/**' pull_request: branches: [ 'main' ] + types: [opened, synchronize] paths: - 'src/**' - 'test/**' @@ -25,6 +26,8 @@ permissions: jobs: build-and-test: + name: Build and test + timeout-minutes: 15 # skip ci if PR has label 'skip-ci' or 'skip-actions' if: | !contains(github.event.pull_request.labels.*.name, 'skip-ci') && @@ -39,19 +42,40 @@ jobs: steps: - name: Copy repository uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'pnpm' - cache-dependency-path: ./pnpm-lock.yaml + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install dependencies run: pnpm install + - name: Lint code run: pnpm lint + - name: Build project run: pnpm build + + - name: Build docs + run: pnpm docs:build + - name: Run UT tests run: pnpm test diff --git a/.husky/pre-commit b/.husky/pre-commit index 9f3229b..0dce18c 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD) -REGEX="^(feature|bugfix|hotfix|release|merge)\.([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)$" +REGEX="^(feature|feat|chore|fix|bugfix|hotfix|docs|refactor|test|build|perf|style|ci|release|merge)\.([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)$" RED='\033[0;31m' GREEN='\033[0;32m' @@ -7,7 +7,7 @@ NC='\033[0m' echo "Branch name: ${GREEN}$BRANCH${NC}" if ! echo "$BRANCH" | grep -qE "$REGEX"; then echo "${RED}Your commit was rejected due to branching name" - echo "Please rename your branch with '(feature|bugfix|hotfix|release|merge)(.?).' syntax${NC}" + echo "Please rename your branch with '(feature|feat|chore|fix|bugfix|hotfix|docs|refactor|test|build|perf|style|ci|release|merge)(.?).' syntax${NC}" exit 1 fi