zhelingwang is learning GitHub Actions #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 自动化测试 | |
run-name: ${{ github.actor }} is learning GitHub Actions | |
# events 定义触发事件以及条件 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/**' | |
- '__test__/**' | |
- 'src/**' | |
# tags: | |
# - v1.** | |
workflow_dispatch: | |
jobs: | |
# 第一个任务 | |
test: | |
# 虚拟机的系统 | |
runs-on: ubuntu-latest | |
steps: | |
# 一个 - 就是一个step | |
# 第三方action: git pull repo code on virtual runner server | |
- uses: actions/checkout@v2 | |
# 第三方action: 安装nodejs | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20 | |
- name: lint and test | |
# 多行写法 | 开头 | |
run: | | |
npm i | |
npm run lint | |
npm run test |