23

让Github Action在你自己的机器上跑起来

 4 years ago
source link: http://yikun.github.io/2020/04/17/让Github-Action在你自己的机器上跑起来/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Github在2019年8月,宣布推出了一项新的功能—— Github Action ,让成千上万的开源项目可以利用Github提供的计算资源完成构建、测试、部署等CI/CD,并且提供 Self Hosted Runners 功能,让开发者们可以将自己的机器接入到Github中来。

最近,我们利用这一功能,将搭载着 openEuler 20.03 (LTS) 操作系统 ,跑在 Kunpeng 920 处理器 的ARM环境接入进来,在近期华为与阿里合作的 MPAM 项目,也将充分的利用这些资源利用Github Action的能力完成构建与测试。

本篇文章将接入方法分享给大家,希望能够帮助更多同学们把 自己的ARM环境 也在Github上用起来。

1. 接入资源

RVbiAnm.png!web 资源的接入流程比较简单:

  1. 依次点击项目的 SettingsActions 进入资源接入页面,点击 Add Runner
  2. 根据弹出的提示,下载和运行脚本

    mQV36fz.png!web
  3. 完成后我们可以看到接入的资源:

    FvQreqb.png!web

2. 使用资源

yu2qmuv.png!web 我们为接入的项目增加一个Action:

name: Run some script in Kunpeng env

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: self-hosted

    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2

    - name: Run `uname -a` in Kunpeng env
      run: |
        uname -a
        cat /etc/os-release
        lscpu | grep -E "Architecture|Model name|CPU\(s\):"

这样,这个workflow是展示所接入的环境上内核、操作系统、处理器信息,我们可以从结果看到job的结果:

QVfUvm7.png!web

点击 Details 可以进入详情页面:

yYv63qY.png!web

可以看到,我们在资源上执行的指令,已经运行成功,可以看到这台资源的系统为 openEuler 20.03 (LTS) ,CPU为aarch64 128核的 Kunpeng 920

3.结语

本文介绍了我们是如何将搭载着鲲鹏920处理器、openEuler操作系统的计算资源接入到Github Action的。可以看到Github Action的自定义资源接入,在ARM64下还是很顺滑的。

希望这篇文章能够帮助到大家,大家也可以尝试着将你们自己ARM资源接入进来,有问题可以留言一起讨论,玩的开心!:)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK