Skip to content

Commit

Permalink
Merge pull request #1040 from sanfrancrisko/GH-1039/main/ghactions_li…
Browse files Browse the repository at this point in the history
…nux_accept_tests

(GH-1039) Acceptance tests for Linux on GHActions Workflow
  • Loading branch information
jpogran committed Apr 7, 2021
2 parents 4f2fbf0 + bc386f6 commit b632be6
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 49 deletions.
19 changes: 19 additions & 0 deletions .dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,22 @@
:why: https://github.com/puppetlabs/facter/blob/d85f088d74f60859a23e6dbae3f83d918dff504a/LICENSE
:versions: []
:when: 2019-04-05 00:51:23.372598896 Z
- - :permit
- BSD
- :who: DavidS
:why: standard license
:versions: []
:when: 2021-03-31 08:27:14.976580116 Z
- - :permit
- 2-clause BSDL
- :who: DavidS
:why: standard license
:versions: []
:when: 2021-03-31 08:27:24.951961169 Z
- - :approve
- log4r
- :who: DavidS
:why: 'dug up original source on github, licensed as LGPLv3: https://github.com/colbygk/log4r/tree/40e2c2edd657a21b34f09dec7de238f348b6f428'
:versions:
- 1.1.10
:when: 2021-03-31 08:49:39.015791690 Z
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixtures:
repositories:
provision: 'https://github.com/puppetlabs/provision.git'
60 changes: 60 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Acceptance Tests"

on: [pull_request]

env:
BOLT_GEM: true
CI: true
BUNDLE_JOBS: 4
BUNDLE_WITH: "acceptance_ci"

jobs:
Acceptance:
name: 'Acceptance Tests (Ruby ${{ matrix.ruby_version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- provider: docker
ruby_version: 2.5
image: ruby:2.5

steps:
- name: Checkout Source
uses: actions/checkout@v2

- name: Activate Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true

- name: Provision Test Environment
run: |
echo "Provisioning using ${{ matrix.provider }}: ${{ matrix.image }}"
bundle exec rake 'litmus:provision[${{ matrix.provider }},${{ matrix.image }}]'
- name: Checkout Source (Test Target)
run: |
echo "Cloning $GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
bundle exec bolt command run "git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY" --targets ssh_nodes --inventory inventory.yaml
echo "Fetching ${{ github.event.number }}"
bundle exec bolt command run "cd pdk && git fetch origin pull/${{ github.event.number }}/head:pdk_test_repo" --targets ssh_nodes --inventory inventory.yaml
echo "Checking out to ${{ github.event.number }}"
bundle exec bolt command run "cd pdk && git checkout pdk_test_repo" --targets ssh_nodes --inventory inventory.yaml
echo "Running bundle install in container"
- name: Bundle Install (Test Target)
run: |
echo "Running bundle install in container"
bundle exec bolt command run "cd pdk && bundle install --with acceptance" --targets ssh_nodes --inventory inventory.yaml
- name: Exec Acceptance Tests
run: |
bundle exec bolt command run 'cd pdk && CI=true bundle exec rake acceptance:local_parallel' --targets ssh_nodes --inventory inventory.yaml
- name: Tear Down
if: ${{ always() }}
run: |
bundle exec rake 'litmus:tear_down'
6 changes: 3 additions & 3 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
name: "Static & Spec Tests (Ruby ${{ matrix.ruby_version }})"
env:
BUNDLE_JOBS: 4
BUNDLE_WITHOUT: "development"
BUNDLE_WITH: "test"
strategy:
fail-fast: false
matrix:
ruby_version: ['2.5', '2.7']
runs-on: ubuntu-latest

steps:
- name: Checkout Source
uses: actions/checkout@v2
Expand Down Expand Up @@ -60,4 +60,4 @@ jobs:
bundler-cache: true

- name: 'License Finder'
run: bundle exec rake license_finder
run: bundle exec rake license_finder
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
*.swp
/.config
/coverage/
/inventory.yaml
/InstalledFiles
/pkg/
/spec/fixtures/
/spec/reports/
/spec/examples.txt
/test/tmp/
Expand Down
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ group :acceptance do
gem 'serverspec'
end

group :acceptance_ci do
gem 'puppet_litmus'
gem 'puppetlabs_spec_helper'
end

# Evaluate Gemfile.local and ~/.gemfile if they exist
extra_gemfiles = [
"#{__FILE__}.local",
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'bundler/gem_tasks'
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/tasks/fixtures' if Bundler.rubygems.find_name('puppetlabs_spec_helper').any?
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def expects(expected)

describe command('pdk bundle env') do
its(:exit_status) { is_expected.not_to eq(0) }
if ENV['APPVEYOR']
if ENV['APPVEYOR'] || ENV['CI']
# TODO: This is very strange that Appveyor emits the error on STDOUT instead of STDERR
# For moment switch the expectation based on the APPVEYOR environment variable
its(:stdout) { is_expected.to match(%r{error parsing `gemfile`}i) }
Expand Down

0 comments on commit b632be6

Please sign in to comment.