From 13195de6f52c4f2ccac45fc5b2d43b98c96a4d9a Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Thu, 25 Dec 2025 17:50:32 +0800 Subject: [PATCH 1/2] ci: add GitHub Action for atsds-egg (Jest) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Summary 为新添加的 `atsds-egg` 库配置了 GitHub Action 自动化工作流。 2. Changes - 新增 `.github/workflows/egg-jest.yml`。 - 配置了针对 Node.js 20, 22, 24 版本的 Jest 测试矩阵。 - 添加了基于 Git Tag 的自动发布到 npm 的 Job (`npm-egg`)。 - 遵循项目中 `bnf-jest.yml` 和 `jest.yml` 的既有规范(缓存配置、工作目录设定等)。 3. Verification - 已确认 `egg/package.json` 中的 `all` 脚本包含 `build` 和 `test`。 - 路径和依赖缓存已正确指向 `egg/` 目录。 --- .github/workflows/egg-jest.yml | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/egg-jest.yml diff --git a/.github/workflows/egg-jest.yml b/.github/workflows/egg-jest.yml new file mode 100644 index 0000000..87c00d2 --- /dev/null +++ b/.github/workflows/egg-jest.yml @@ -0,0 +1,82 @@ +name: egg-jest +permissions: + contents: read + +on: + - pull_request + - push + +env: + NODE_LATEST_VERSION: '24' + +jobs: + jest: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: ['20', '22', '24'] + + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: egg/package-lock.json + + - name: dependencies + working-directory: egg + run: npm ci + + - name: jest + working-directory: egg + run: npm run all + + npm: + runs-on: ubuntu-latest + needs: jest + + if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')" + + environment: + name: npm-egg + url: https://www.npmjs.com/package/atsds-egg + permissions: + id-token: write + + steps: + - uses: actions/checkout@v6 + + - name: recovery tag information + run: git fetch --tags --force + + - uses: actions/setup-node@v6 + with: + node-version: ${{ env.NODE_LATEST_VERSION }} + cache: 'npm' + cache-dependency-path: egg/package-lock.json + + - name: version + working-directory: egg + run: npm version from-git --no-git-tag-version + + - name: extract tag + run: | + GIT_TAG=${GITHUB_REF#refs/tags/} + TAG=$(echo $GIT_TAG | sed -E 's/^v//' | sed -E 's/[0-9\.-]//g' | sed -E 's/^$/latest/g') + echo TAG=$TAG >> $GITHUB_ENV + + - name: dependencies + working-directory: egg + run: npm ci + + - name: build + working-directory: egg + run: npm run build + + - name: publish + working-directory: egg + run: npm publish --tag $TAG From 221ea16e9f977c5c97bcabb5218d1e330a9d5fc3 Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Thu, 25 Dec 2025 17:52:49 +0800 Subject: [PATCH 2/2] Update to keep consistency with other jest actions. --- .github/workflows/egg-jest.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/egg-jest.yml b/.github/workflows/egg-jest.yml index 87c00d2..63ae065 100644 --- a/.github/workflows/egg-jest.yml +++ b/.github/workflows/egg-jest.yml @@ -25,7 +25,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - cache-dependency-path: egg/package-lock.json - name: dependencies working-directory: egg @@ -57,7 +56,6 @@ jobs: with: node-version: ${{ env.NODE_LATEST_VERSION }} cache: 'npm' - cache-dependency-path: egg/package-lock.json - name: version working-directory: egg