Jor*_*lov 17 continuous-integration github github-actions
我想在多个环境上运行 GitHub Actions,比如说在 Windows 和 Linux 上。我设法使用 Travis CI 做到这一点,但我找不到有关如何使用 GitHub Actions 做到这一点的信息。
有人尝试过吗?
这是我的nodejs.yml。
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm ci
- name: prettier format check
run: |
npm run prettier-check
- name: lint format check
run: |
npm run lint-check
- name: build, and test
run: |
npm run build
npm test --if-present
env:
CI: true
Run Code Online (Sandbox Code Playgroud)
riQ*_*iQQ 18
您可以为此使用策略/矩阵(请参阅https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy)
name: Node CI
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm ci
- name: prettier format check
run: |
npm run prettier-check
- name: lint format check
run: |
npm run lint-check
- name: build, and test
run: |
npm run build
npm test --if-present
env:
CI: true
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6016 次 |
最近记录: |