CI/CD配置 in GitHub

CICD

最初是瀑布模型,后来是敏捷开发,现在是DevOps

持续集成(Continuous Integration)持续交付(Continuous Delivery)持续部署(Continuous Deployment)

Github Actions

在这里候遇到了一种特殊的配置文件 .yml
  1. YAML (YAML Ain’t a Markup Language)YAML不是一种标记语言,通常以.yml为后缀的文件,是一种直观的能够被电脑识别的数据序列化格式
  2. YAML易于人们阅读。
  3. k: v 表示键值对关系,冒号后面必须有一个空格
  4. 使用空格的缩进表示层级关系,空格数目不重要,只要是左对齐的一列数据,都是同一个层级的
  5. 大小写敏感
  6. 缩进时不允许使用Tab键,只允许使用空格。
三个重要的点分别是name on job
  1. name: 命名, actions 的名称

  2. on: 触发调教 eg:[psuh]

    ​ push:

    ​ branches:

    ​ -master

    1. sechedule:

      ​ -corn 以特定时间执行

  3. 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)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值