{"id":16179246,"url":"https://github.com/jonashackt/vagrant-github-actions","last_synced_at":"2025-03-19T01:30:55.874Z","repository":{"id":50671580,"uuid":"340010781","full_name":"jonashackt/vagrant-github-actions","owner":"jonashackt","description":"Example project showing how to run a Vagrant box on GitHub Actions","archived":false,"fork":false,"pushed_at":"2021-02-18T13:03:29.000Z","size":9,"stargazers_count":41,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T13:46:43.492Z","etag":null,"topics":["github-actions","vagrant"],"latest_commit_sha":null,"homepage":"https://stackoverflow.com/questions/66261101/using-vagrant-on-github-actions-ideally-incl-virtualbox","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonashackt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-18T10:16:25.000Z","updated_at":"2025-01-24T15:53:33.000Z","dependencies_parsed_at":"2022-09-07T13:51:07.939Z","dependency_job_id":null,"html_url":"https://github.com/jonashackt/vagrant-github-actions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fvagrant-github-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fvagrant-github-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fvagrant-github-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fvagrant-github-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonashackt","download_url":"https://codeload.github.com/jonashackt/vagrant-github-actions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243958073,"owners_count":20374789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","vagrant"],"created_at":"2024-10-10T05:26:19.724Z","updated_at":"2025-03-19T01:30:55.601Z","avatar_url":"https://github.com/jonashackt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# vagrant-github-actions\n[![Build Status](https://github.com/jonashackt/vagrant-github-actions/workflows/vagrant-up/badge.svg)](https://github.com/jonashackt/vagrant-github-actions/actions)\n\nExample project showing how to run a Vagrant box on GitHub Actions\n\n\nI have some history in this topic on how to run Vagrant on Cloud CI systems for OpenSource projects :) See https://stackoverflow.com/a/60615201/4964553 \u0026 https://stackoverflow.com/a/60380518/4964553 - since until somewhere in 2020 the only possible way was TravisCI with libvrt: https://github.com/jonashackt/vagrant-travisci-libvrt\n\nWhat didn't work was plain VirtualBox on Travis: https://github.com/jonashackt/vagrant-travisci and also other CI platforms also did't work like AppVeyor https://github.com/jonashackt/vagrant-ansible-on-appveyor ([I didn't even try the others because of this](https://stackoverflow.com/questions/31828555/using-vagrant-on-cloud-ci-services)).\n\n__BUT__ then the end of 2020 came and Travis defacto ended broad support for OpenSource (see https://github.com/codecentric/cxf-spring-boot-starter/issues/93) and I started to migrate all my repositories to [GitHub Actions](https://github.com/features/actions). I even blogged about it (tba when released).\n\nAnd I finally found out, that [there's Vagrant activated (incl. nested virtualization) on GitHub Action MacOS environment](https://github.com/actions/virtual-environments/issues/433) ([not Linux](https://github.com/actions/virtual-environments/issues/183) or Windows currently).\n\n### How to run Vagrant on GitHub Actions\n\nSo let's first add a [Vagrantfile](Vagrantfile) like this:\n\n```\nVagrant.configure(\"2\") do |config|\n    config.vm.box = \"generic/ubuntu1804\"\n\n    config.vm.define 'ubuntu'\n\n    # Prevent SharedFoldersEnableSymlinksCreate errors\n    config.vm.synced_folder \".\", \"/vagrant\", disabled: true\nend\n```\n\nNow add a MacOS environment powered GitHub Actions `vagrant-up.yml`:\n\n```yaml\nname: vagrant-up\n\non: [push]\n\njobs:\n  vagrant-up:\n    runs-on: macos-10.15\n\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Cache Vagrant boxes\n        uses: actions/cache@v2\n        with:\n          path: ~/.vagrant.d/boxes\n          key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}\n          restore-keys: |\n            ${{ runner.os }}-vagrant-\n\n      - name: Show Vagrant version\n        run: vagrant --version\n\n      - name: Run vagrant up\n        run: vagrant up\n\n      - name: ssh into box after boot\n        run: vagrant ssh -c \"echo 'hello world!'\"\n\n```\n\nAnd since there's no stable release of VirtualBox for Big Sur (v11), well go with MacOS version 10.15 (which is currently also the `macos-latest` [environment on GitHub Actions](https://github.com/actions/virtual-environments))\n\nWe also use the https://github.com/actions/cache action here to cache our Vagrant boxes for further runs. Using `hashFiles('Vagrantfile')` will make sure we only create a new cache, if our `Vagrantfile` changed (and thus assume, that the box name is also different).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Fvagrant-github-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonashackt%2Fvagrant-github-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Fvagrant-github-actions/lists"}