Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from Travis CI to GitHub Actions #130

Merged
merged 3 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test

on:
pull_request: {}
push:
branches: master

env:
BUNDLE_WITHOUT: development:release

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- "3.1"
- "3.0"
- "2.7"
- "2.6"
- "2.5"
- "2.4"
puppet:
- "~> 7.0"
- "~> 6.5"
- "~> 5.5.10"
- "https://github.com/puppetlabs/puppet.git#main"
exclude:
- ruby: "2.6"
puppet: "~> 7.0"
- ruby: "2.5"
puppet: "~> 7.0"
- ruby: "2.4"
puppet: "~> 7.0"

- ruby: "3.1"
puppet: "~> 6.5"
- ruby: "3.0"
puppet: "~> 6.5"

- ruby: "3.1"
puppet: "~> 5.5.10"
- ruby: "3.0"
puppet: "~> 5.5.10"
- ruby: "2.7"
puppet: "~> 5.5.10"
- ruby: "2.6"
puppet: "~> 5.5.10"

- ruby: "2.6"
puppet: "https://github.com/puppetlabs/puppet.git#main"
- ruby: "2.5"
puppet: "https://github.com/puppetlabs/puppet.git#main"
- ruby: "2.4"
puppet: "https://github.com/puppetlabs/puppet.git#main"
name: "Ruby ${{ matrix.ruby }} - Puppet ${{ matrix.puppet }}"
env:
PUPPET_VERSION: ${{ matrix.puppet }}
steps:
- uses: actions/checkout@v3
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
# `git://somewhere.git#branch`. You can also use a file source location, which
# is specified as `file://some/location/on/disk`.
def location_for(place_or_version, fake_version = nil)
if place_or_version =~ /^(git[:@][^#]*)#(.*)/
if place_or_version =~ /^(https[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place_or_version =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
Expand All @@ -19,12 +19,12 @@ gemspec

# Override gemspec for CI matrix builds.
# But only if the environment variable is set
gem 'puppet', *location_for(ENV['PUPPET_VERSION'] || '>= 5') if ENV['PUPPET_VERSION']
gem 'puppet', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION']

group :test do
gem 'rspec'
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator'
gem 'github_changelog_generator', require: false
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/voxpupuli/puppet-syntax.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-syntax)
TODO: [![Build Status](https://travis-ci.org/voxpupuli/puppet-syntax.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-syntax)
[![Gem Version](https://img.shields.io/gem/v/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax)
[![Gem Downloads](https://img.shields.io/gem/dt/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax)

Expand All @@ -14,7 +14,7 @@ Puppet::Syntax is supported with:
- Puppet >= 5.0 that provides the `validate` face.
- Ruby >= 2.4

For the specific versions that we test against, see the [TravisCI config](.travis.yml).
For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/test.yml).

## Installation

Expand Down
1 change: 1 addition & 0 deletions lib/puppet-syntax/tasks/puppet-syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class RakeTask < ::Rake::TaskLib
def filelist(paths)
excludes = PuppetSyntax.exclude_paths
excludes.push('pkg/**/*')
excludes.push('vendor/**/*')
files = FileList[paths]
files.reject! { |f| File.directory?(f) }
files.exclude(*excludes)
Expand Down
7 changes: 6 additions & 1 deletion lib/puppet-syntax/templates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ def validate_erb(filename)
result = { warnings: [], errors: [] }

begin
erb = ERB.new(File.read(filename), nil, '-')
template = File.read(filename)
erb = if RUBY_VERSION >= '2.6'
ERB.new(template, trim_mode: '-')
else
ERB.new(template, nil, '-')
end
erb.filename = filename
erb.result
rescue NameError => error
Expand Down