|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + name: test (${{ matrix.os }}, node ${{ matrix.node }}) |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + timeout-minutes: 15 |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 20 | + node: [22, 24] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 23 | + with: |
| 24 | + persist-credentials: false |
| 25 | + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 26 | + with: |
| 27 | + node-version: ${{ matrix.node }} |
| 28 | + # 全部离线:假 gh / 假 git / 假 AI,不访问 GitHub |
| 29 | + - run: npm test |
| 30 | + |
| 31 | + package: |
| 32 | + name: official package checks |
| 33 | + runs-on: ubuntu-latest |
| 34 | + timeout-minutes: 10 |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 37 | + with: |
| 38 | + persist-credentials: false |
| 39 | + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 40 | + with: |
| 41 | + node-version: 22 |
| 42 | + # 官方社区仓库(MiniMax-AI/MiniMax-Code-MiniApps)里的包校验脚本,固定在一个已验证过的提交上。 |
| 43 | + # 只拉目录结构和 scripts/ 里的文件(不下载仓库里的截图和动图),几秒钟就好。 |
| 44 | + # 想跟进它的新规则:把下面的哈希换成社区仓库的新提交,再看本地和 CI 是否仍然通过。 |
| 45 | + - name: Fetch the community validator (pinned, scripts only) |
| 46 | + run: | |
| 47 | + git init --quiet "$RUNNER_TEMP/community" |
| 48 | + cd "$RUNNER_TEMP/community" |
| 49 | + git remote add origin https://github.com/MiniMax-AI/MiniMax-Code-MiniApps |
| 50 | + git sparse-checkout set --cone scripts |
| 51 | + git fetch --quiet --depth 1 --filter=blob:none origin cfcaa0f74fe08d2b40f598ae27e540c94f4bd026 |
| 52 | + git checkout --quiet FETCH_HEAD |
| 53 | + # 校验的是 git 跟踪的文件(不带 .git,和「从 Git 仓库导入」看到的一样);目录名必须等于插件 ID |
| 54 | + - name: Validate this package |
| 55 | + run: | |
| 56 | + mkdir -p "$RUNNER_TEMP/pkg/github-star-shelf" |
| 57 | + git archive HEAD | tar -x -C "$RUNNER_TEMP/pkg/github-star-shelf" |
| 58 | + node "$RUNNER_TEMP/community/scripts/validate.mjs" "$RUNNER_TEMP/pkg/github-star-shelf" |
0 commit comments