GitHub 上可以使用matrix方便的处理不同平台的并行构建,迁移到cnb上如何实现对应的功能?#6
jobs: example_matrix: strategy: matrix: version: [10, 12, 14] os: [ubuntu-latest, windows-latest]
github action中可以使用matrix比较方便的处理多平台多架构的并行构建,迁移到cnb如何实现对应功能?
补充一个完整 matrix 的示例,在 github 中可以使用 matrix 比较方便的测试自己的应用在不同平台的兼容性,使用 matrix 语法来声明任务跑的环境矩阵。
jobs: matrix-test: runs-on: ubuntu-latest strategy: matrix: node: [14, 16, 18] os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - run: npm ci && npm test
#16
使用 yaml 原生就能做到,太简单了,而且更灵活
yaml
.jobs: - node -v - npm ci - npm test main: push: - docker: image: node:14 stages: - *jobs - docker: image: node:16 stages: - *jobs - docker: image: node:18 stages: - *jobs
jobs: example_matrix: strategy: matrix: version: [10, 12, 14] os: [ubuntu-latest, windows-latest]github action中可以使用matrix比较方便的处理多平台多架构的并行构建,迁移到cnb如何实现对应功能?