Continuous integration 在GitHub上使用Vagrant操作(理想情况下包括VirtualBox)
我知道,在TravisCI上使用Continuous integration 在GitHub上使用Vagrant操作(理想情况下包括VirtualBox),continuous-integration,vagrant,virtual-machine,virtualbox,github-actions,Continuous Integration,Vagrant,Virtual Machine,Virtualbox,Github Actions,我知道,在TravisCI上使用libvirt而不是VirtualBox来启动和运行流浪箱是可能的 GitHub操作也可以这样做吗?由于,我们正在将所有内容从TravisCI中移出,因此我们还需要切换基于Vagrant的测试用例。是的,(也就是说。您也可以尝试使用macos-11.0,但我在 假设您的回购协议中有如下内容: Vagrant.configure("2") do |config| config.vm.box = "generic/ubuntu18
libvirt
而不是VirtualBox来启动和运行流浪箱是可能的
GitHub操作也可以这样做吗?由于,我们正在将所有内容从TravisCI中移出,因此我们还需要切换基于Vagrant的测试用例。是的,(也就是说。您也可以尝试使用macos-11.0
,但我在
假设您的回购协议中有如下内容:
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1804"
config.vm.define 'ubuntu'
# Prevent SharedFoldersEnableSymlinksCreate errors
config.vm.synced_folder ".", "/vagrant", disabled: true
end
name: vagrant-up
on: [push]
jobs:
vagrant-up:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Cache Vagrant boxes
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Run vagrant up
run: vagrant up
- name: ssh into box after boot
run: vagrant ssh -c "echo 'hello world!'"
然后在.GitHub/workflows
文件夹中添加一个GitHub操作工作流,如下所示:
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1804"
config.vm.define 'ubuntu'
# Prevent SharedFoldersEnableSymlinksCreate errors
config.vm.synced_folder ".", "/vagrant", disabled: true
end
name: vagrant-up
on: [push]
jobs:
vagrant-up:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Cache Vagrant boxes
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Run vagrant up
run: vagrant up
- name: ssh into box after boot
run: vagrant ssh -c "echo 'hello world!'"
你甚至可以省去——我只是把它添加到这里来说明可能的情况。它会节省你几秒钟的时间,这取决于你正在使用的流浪者箱
运行Vagrant的GitHub Actions实现要容易得多,因为您不需要安装Vagrant或VirtualBox,也不需要切换到libvirt。只需使用您想要的框,它非常酷