Updates to make vagrant-spec work in CI

* The vagrant-spec gem is installed as part of bundle install so
   there's no need to install it separately. Remove those extra steps
   and invoke it with bundle exec instead.
 * The binstub for vagrant does not work with `--standalone` in CI, but
   the one generated w/o `--standalone` works fine. This also seems to
   work in dev, so we'll just switch to that one.
 * Fetch all tags in CI to make sure we're getting proper version
   numbers in our build (based off `git describe`).
This commit is contained in:
Paul Hinze 2022-03-31 14:39:40 -05:00
parent 9a61574f52
commit 2efa6547f4
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 28 additions and 14 deletions

View File

@ -27,6 +27,9 @@ jobs:
uses: actions/checkout@v2
with:
submodules: 'recursive'
# Also fetch all tags, since we need our version number in the build
# to be based off a tag
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v2
with:
@ -46,17 +49,13 @@ jobs:
env:
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
- name: Get vagrant-spec repo
uses: actions/checkout@v2
with:
repository: 'hashicorp/vagrant-spec'
path: vagrant-spec
- name: Install and run vagrant-spec
- name: Add binstubs to path
run: |
pushd vagrant-spec
gem build vagrant-spec.gemspec
gem install vagrant-spec-0.0.1.gem
popd
VAGRANT_PATH="$GITHUB_WORKSPACE/vagrant" vagrant-spec test --components=cli/version --config test/vagrant-spec/configs/vagrant-spec.config.virtualbox.rb
echo "$PWD/binstubs" >> $GITHUB_PATH
env:
VAGRANT_SPEC_BOX: "hashicorp/bionic64"
- name: Run vagrant-spec
run: |
VAGRANT_PATH="$GITHUB_WORKSPACE/vagrant" bundle exec vagrant-spec test --components=cli/version --config test/vagrant-spec/configs/vagrant-spec.config.virtualbox.rb
env:
VAGRANT_SPEC_BOX: "hashicorp/bionic64"

View File

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
@ -7,8 +9,21 @@
#
require "pathname"
path = Pathname.new(__FILE__)
$:.unshift File.expand_path "../..", path.realpath
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load File.expand_path "../../bin/vagrant", path.realpath
load Gem.bin_path("vagrant", "vagrant")