Skip to content

ccoalm/ccl-skills / skills/test-artifact-management

test-artifact-management

Verified

Create and maintain structured test cases from requirements or code, including initializing or reusing the Feishu Bitable, canonical fields, import, update, status sync, and deprecation. Use for 写测试用例, 写测试用例文档, test-case documents, TC, source-to-TC generation, 初始化测试用例多维表格, 测试用例放飞书, and 导入/更新/同步/废弃测试用例. Skip executable test code, coverage, CI gates, mocks, and regression verification → testing-strategy; broader feature delivery → product-rd-workflow.

references/ci_templates/github-actions.yml

View on GitHub
# GitHub Actions template — run tests, publish Feishu report, comment on PR.
#
# Replace <unit> placeholders with your deployable-unit directory (e.g. "web",
# "app", "services/auth"). Copy this into .github/workflows/test-<unit>.yml.
#
# Required repository secrets:
#   LARK_BOT_APP_ID      — Feishu bot app id (for lark-cli --as bot)
#   LARK_BOT_APP_SECRET  — Feishu bot app secret  (piped via stdin, NEVER in argv)
#
# Already committed in <unit>/test/.report-config.json (resource IDs, not secrets):
#   base_token, table_id, folder_token (optional), report_doc_url

name: Test (<unit>)

on:
  pull_request:
    paths:
      - '<unit>/**'
      - '.github/workflows/test-<unit>.yml'
  push:
    branches: [main]
    paths:
      - '<unit>/**'

# Serialize same-unit runs to avoid concurrent Bitable writes losing each other
# (gen_report.py has no CAS; last-write-wins).
concurrency:
  group: tc-report-<unit>-${{ github.ref }}
  cancel-in-progress: false

permissions:
  contents: read
  pull-requests: write   # required for gh pr comment

jobs:
  test:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: <unit>
    steps:
      - uses: actions/checkout@v4

      # ── Stack setup (pick one; remove the rest) ─────────────────────────
      - uses: actions/setup-node@v4    # Vitest / Jest
        with: { node-version: '20' }
      # - uses: actions/setup-python@v5
      #   with: { python-version: '3.12' }
      # - uses: actions/setup-go@v5
      #   with: { go-version: '1.22' }

      - name: Install lark-cli + auth (stdin, no argv exposure)
        env:
          LARK_BOT_APP_ID: ${{ secrets.LARK_BOT_APP_ID }}
          LARK_BOT_APP_SECRET: ${{ secrets.LARK_BOT_APP_SECRET }}
        run: |
          npm i -g @larksuiteoapi/lark-cli  # adjust to your distribution channel
          # Pipe the secret via stdin; --app-secret-stdin keeps it OUT of ps/argv.
          printf '%s' "$LARK_BOT_APP_SECRET" | \
            lark-cli config init \
              --app-id "$LARK_BOT_APP_ID" \
              --app-secret-stdin \
              --brand feishu

      # Cache key includes run_id so each run produces a NEW cache entry that
      # actions/cache will save (otherwise an exact-key hit prevents the save).
      # restore-keys falls back to the most recent prior cache for this branch,
      # then to main.
      - name: Restore last-run snapshot (for vs-last-run diff)
        uses: actions/cache@v4
        with:
          path: <unit>/test/results/last-run.json
          key: tc-last-run-<unit>-${{ github.ref_name }}-${{ github.run_id }}
          restore-keys: |
            tc-last-run-<unit>-${{ github.ref_name }}-
            tc-last-run-<unit>-main-

      - name: Install dependencies
        run: npm ci      # or: uv pip install -e . / go mod download

      - name: Run tests + sync Bitable + publish Feishu report
        id: report_run
        run: make report-run
        env:
          # bot identity is auto-detected by gen_report.py when CI=true
          CI: 'true'
          # Sidecar write failures should fail tests (no silent Bitable staleness).
          TC_SIDECAR_STRICT: '1'

      # IMPORTANT: run even when report_run failed — that's when the summary
      # matters most. fail-soft (continue-on-error + || true) so missing
      # python / config / helper doesn't fail the job AFTER red tests.
      # Write under the unit working-dir so hashFiles() (workspace-relative)
      # can see the artifact in the next step.
      - name: Build PR comment summary
        if: always() && github.event_name == 'pull_request'
        continue-on-error: true
        run: |
          set +e
          python test/scripts/gen_report.py \
            --config test/.report-config.json \
            --pr-summary --fail-on=never > pr-summary.md 2>pr-summary.err || true

      - name: Post PR comment
        if: always() && github.event_name == 'pull_request' && hashFiles('<unit>/pr-summary.md') != ''
        continue-on-error: true
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh pr comment "${{ github.event.pull_request.number }}" \
            --body-file pr-summary.md || true

      - name: Upload JUnit + sidecar (for debugging)
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: test-results-<unit>
          path: <unit>/test/results/
          retention-days: 7
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall