act 本地运行github actions 工具(Act runs the GitHub actions tool locally)

github actions 是一个很不错的ci/cd 能力,我们可以使用github 提供的免费能力,自动化我们软件的构建,测试,以及发布但是默认github actions 是需要云端资源的,很多时候我们是需要本地运行的act 就是一个可以让我们本地运行github actions的工具

本地运行github actions 的原因

  • 快速反馈,我们不用通过每次提交之后以及调度之后才能查看效果,直接可以本地运行
  • 本地的任务runner 可以使用本地的github actions 替换makefile
  • 增强github actions 使用的信心

工作原理

act 实际上是通过读取本地的.github/workflows 目录里边定义的actions,使用docker api pull 或者构建需要的镜像然后按需执行,当然实际上不同阶段还会包含一些中间结果的,这个也是act 解决的

说明

act 很值得使用,既可以学习github actions,同时还可以将github actions 能力本地化

参考资料

https://github.com/nektos/act

————————

GitHub actions is a very good CI / CD capability. We can use the free capabilities provided by GitHub to automate the construction, testing and publishing of our software. However, by default, GitHub actions requires cloud resources. In many cases, we need to run locally. Act is a tool that allows us to run GitHub actions locally

本地运行github actions 的原因

  • Fast feedback. We don’t need to view the effect after each submission and scheduling. We can run it locally directly
  • 本地的任务runner 可以使用本地的github actions 替换makefile
  • 增强github actions 使用的信心

working principle

Act is actually read locally The actions defined in the GitHub / workflow directory use the docker API to pull or build the required image, and then execute on demand. Of course, there are some intermediate results in different stages, which is also solved by act

explain

Act is worth using. You can learn GitHub actions and localize GitHub actions

reference material

https://github.com/nektos/act