diff --git a/.github/workflows/go-spectest.yml b/.github/workflows/go-spectest.yml index 3dc6b8e13..399e14755 100644 --- a/.github/workflows/go-spectest.yml +++ b/.github/workflows/go-spectest.yml @@ -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" diff --git a/binstubs/vagrant b/binstubs/vagrant index 55a2a5eed..b74047464 100755 --- a/binstubs/vagrant +++ b/binstubs/vagrant @@ -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")