{
"name": "Matrix and dependencies",
"on": [
"workflow_dispatch"
],
"permissions": {
"contents": "read"
},
"env": {
"APP_NAME": "mbsky"
},
"jobs": {
"test": {
"runs-on": "${{ matrix.os }}",
"strategy": {
"fail-fast": false,
"matrix": {
"os": [
"ubuntu-latest",
"windows-latest"
],
"node": [
"22",
"24"
],
"exclude": [
{
"os": "windows-latest",
"node": "22"
}
],
"include": [
{
"os": "ubuntu-latest",
"node": "24",
"experimental": true
}
]
}
},
"timeout-minutes": 10,
"steps": [
{
"uses": "actions/checkout@11d5960a326750d5838078e36cf38b85af677262",
"with": {
"persist-credentials": false
}
},
{
"uses": "actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020",
"with": {
"node-version": "${{ matrix.node }}"
}
},
{
"run": "node --test app.test.mjs"
}
]
},
"summary": {
"runs-on": "ubuntu-latest",
"needs": [
"test"
],
"steps": [
{
"run": "echo \"All matrix tests completed\""
}
]
}
}
}
本例需在 Windows Git2.54 / Python3.12;测验Edge156 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:Windows Git2.54 / Python3.12;测验Edge156
入口文件:projects/git-lab/workflows/matrix.json.example
预期结果与验证条件观察提示
- 模板有具体事件、jobs与steps;实际GitHub运行仍待环境,不以本地静态检查代替
请结合实际环境逐项观察。
附件与关联工程包下载
课程关联工程包(登记关联16章) · 含当前章节或实例 · mbskycom202611a514.zip