CICD
最初是瀑布模型,后来是敏捷开发,现在是DevOps
持续集成(Continuous Integration)、持续交付(Continuous Delivery) 、持续部署(Continuous Deployment)
Github Actions
在这里候遇到了一种特殊的配置文件 .yml
- YAML (YAML Ain’t a Markup Language)YAML不是一种标记语言,通常以.yml为后缀的文件,是一种直观的能够被电脑识别的数据序列化格式
- YAML易于人们阅读。
- k: v 表示键值对关系,冒号后面必须有一个空格
- 使用空格的缩进表示层级关系,空格数目不重要,只要是左对齐的一列数据,都是同一个层级的
- 大小写敏感
- 缩进时不允许使用Tab键,只允许使用空格。
三个重要的点分别是name on job
-
name: 命名, actions 的名称
-
on: 触发调教 eg:[psuh]
push:
branches:
-master
-
sechedule:
-corn 以特定时间执行
-
-
jobs: job1: runs-on: (八选一) ubuntu-latest setps: #拷贝代码 #用了别人的 - uses: actioins/checkout@v1 #实际上用actions用户的方法下载了代码 - uses: actions/setup-node@v1 #用actions用户的方法配置了node - run: echo "hello" npm install npm run build --if-present npn test
my example: (actions.yml)
# This is a basic workflow to help you get started with Actions
name: PythoSendMial
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push: #只要有push动作即会on
schedule: #通过时间设置
- cron: '05 23 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy: #规定多路复用
matrix:
python-version: [3.8]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 #下载了代码
# Runs a single command using the runners shell
- name: set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# 安装了依赖
- name: Run app
run: |
python3 autoSend.py
#run下即执行批处理脚本故 (python、python3)