Skip to content

Commit fd9c500

Browse files
authored
Merge pull request #7 from bastelfreak/ci
CI: Run unit tests on all Ruby 2.7-3.3
2 parents 67fea93 + 8a61fe8 commit fd9c500

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

.github/workflows/unit.yaml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1+
---
12
name: Unit tests
23

34
on:
4-
pull_request:
5-
types: [opened, reopened, edited, synchronize]
6-
paths:
7-
- .github/workflows/unit.yaml
8-
- bolt.gemspec
9-
- Gemfile
10-
- Puppetfile
11-
- bolt-modules/**
12-
- lib/bolt/**
13-
- libexec/**
14-
- rakelib/tests.rake
15-
- spec/**
5+
pull_request: {}
6+
push:
7+
branches:
8+
- main
169

17-
env:
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
permissions:
11+
contents: read
1912

2013
jobs:
2114

2215
unit:
23-
name: Unit
16+
name: "Ruby ${{ matrix.ruby }}"
2417
strategy:
18+
fail-fast: false
2519
matrix:
26-
os: [ubuntu-22.04, windows-latest]
27-
ruby: [3.1]
20+
os: [ubuntu-24.04, windows-latest]
21+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
2822
runs-on: ${{ matrix.os }}
2923
steps:
3024
- name: Checkout repository
@@ -34,8 +28,8 @@ jobs:
3428
with:
3529
ruby-version: ${{ matrix.ruby }}
3630
bundler-cache: true
37-
- name: Update gems
38-
run: bundle update
31+
- name: Output Ruby Environment
32+
run: bundle env
3933
- name: Cache modules
4034
id: modules
4135
uses: actions/cache@v4
@@ -47,3 +41,11 @@ jobs:
4741
run: bundle exec r10k puppetfile install
4842
- name: Unit tests
4943
run: bundle exec rake tests:unit
44+
45+
tests:
46+
needs:
47+
- unit
48+
runs-on: ubuntu-24.04
49+
name: Test suite
50+
steps:
51+
- run: echo Test suite complete

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
## Environment normalization:
2323
/.bundle/
24-
/vendor/bundle
24+
/vendor/
25+
/.vendor/
2526
/lib/bundler/man/
2627

2728
Gemfile.lock

spec/unit/outputter/human_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@
273273

274274
it "prints empty results from a plan" do
275275
outputter.print_plan_result(Bolt::PlanResult.new([], 'success'))
276-
expect(output.string).to eq("[]\n")
276+
# json 2.8 changed the array/hash formatting. Ruby 3.0 ships json 2.8+, Ruby 2.7 has an older version
277+
# interestingly, in openvox the default is the old behaviour, in bolt it's the new behaviour
278+
# https://github.com/OpenVoxProject/puppet/pull/132
279+
major_version = RUBY_VERSION.split('.').first.to_i
280+
if major_version == 2
281+
expect(output.string).to eq("[\n\n]\n")
282+
else
283+
expect(output.string).to eq("[]\n")
284+
end
277285
end
278286

279287
it "formats unwrapped ExecutionResult from a plan" do

0 commit comments

Comments
 (0)