Github Action
actions/cache
或者直接点下方的链接,直接跳到相关cache的例子
-
Examples
- C# - NuGet
- D - DUB
- Elixir - Mix
- Go - Modules
- Haskell - Cabal
- Java - Gradle
- Java - Maven
- Node - npm
- Node - Lerna
- Node - Yarn
- Node - Yarn 2
- OCaml/Reason - esy
- PHP - Composer
- Python - pip
- Python - pipenv
- R - renv
- Ruby - Bundler
- Rust - Cargo
- Scala - SBT
- Swift, Objective-C - Carthage
- Swift, Objective-C - CocoaPods
- Swift - Swift Package Manager
矩阵 matrix
jobs:
build:
strategy:
matrix:
# 指定node版本 矩阵指定多版本
node-version: [12.x, 14.x, 15.x]
# 指定os
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
# 用变量的形式,自动分配
runs-on: ${{ matrix.os }}
# 用变量的形式,自动分配
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
#有些任务是不能在其他环境运行的
# 比如GabrielBB/xvfb-action@v1 只能在linux 下使用
# 用if条件判断一下就好
- name: Run headless unit test
if: matrix.os == 'ubuntu-latest'
uses: GabrielBB/xvfb-action@v1
with:
run: |
yarn test
yarn e2e
# node 后续任务