如何在本地运行GitHub Actions工作流? [英] How to run GitHub Actions workflows locally?

查看:90
本文介绍了如何在本地运行GitHub Actions工作流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用Docker将我们的Travis CI构建迁移到GitHub Actions进行每次提交测试.

I am planning to move our Travis CI build to GitHub Actions using Docker for our per-commit testing.

我可以在本地可复制地运行这些新的GitHub Actions工作流吗?有一种通用的方法可以在本地运行任何GitHub Actions工作流吗?

Can I reproducibly run these new GitHub Actions workflows locally? Is there a generic way to run any GitHub Actions workflow locally?

推荐答案

有些工具已经提到了 act ,但是它们并不完美.您并不孤单.类似的问题是:

There are tools like the already-mentioned act, but they are not perfect. You are not alone with this issue. Similar problems are:

  • 如何在本地测试Jenkins构建
  • 如何在本地测试GitLab CI构建
  • 如何在本地测试Circle CI构建
  • 如何在本地测试XXXX版本

我对这些问题的解决方案是:

And my solution for these problems is:

  • 避免使用CI工具提供的功能(GitHub Actions,Gitlab CI等)
  • 以与CI无关的方式(BASH脚本,PowerShell脚本,Gradle脚本,NPM脚本,Dockerfiles,Ansible脚本-任何您知道的东西)尽可能多地编写
  • 从CI工具中调用这些脚本.在GitHub中,操作: run:您要运行的命令

这篇关于如何在本地运行GitHub Actions工作流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆