-
Notifications
You must be signed in to change notification settings - Fork 9
174 lines (155 loc) · 4.65 KB
/
ci.yaml
File metadata and controls
174 lines (155 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
name: CI
on:
pull_request: {}
push:
branches:
- main
# minimal permissions
permissions:
contents: read
jobs:
rubocop_and_matrix:
runs-on: ubuntu-24.04
outputs:
ruby: ${{ steps.ruby.outputs.versions }}
steps:
- uses: actions/checkout@v6
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Run Rubocop
run: bundle exec rake rubocop
- run: gem build --strict --verbose *.gemspec
- id: ruby
uses: voxpupuli/ruby-version@v2
linux_unit_tests:
needs:
- rubocop_and_matrix
name: Unit tests on Linux with Ruby ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
include:
- ruby: 'jruby-9.4.12.1'
- ruby: 'jruby-10.0.2.0'
runs-on: ubuntu-24.04
steps:
- name: Checkout current PR
uses: actions/checkout@v6
- name: Rspec checks
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake spec_random
windows_unit_tests:
name: Unit tests on Windows with Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '2.7'
- '3.2'
runs-on: windows-2025
steps:
- name: Checkout current PR
uses: actions/checkout@v6
- name: Rspec checks
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake spec_random
acceptance_tests:
name: Platform
strategy:
matrix:
os:
- windows-2022
- ubuntu-22.04
- ubuntu-24.04
fail-fast: false
runs-on: ${{ matrix.os }}
env:
BEAKER_debug: true
FACTER_ROOT: facter
RELEASE_STREAM: puppet8
steps:
- name: Checkout current PR
uses: actions/checkout@v6
with:
path: facter
- name: Install Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Fix common Linux and macOS permissions
if: runner.os != 'Windows'
run: sudo chmod a-w /opt
- name: Fix Linux permissions
if: runner.os == 'Linux'
run: |
sudo chmod a-w /home/runner /usr/share &&
sudo chmod -R a-w /home/runner/.config /home/linuxbrew
- name: Install dhclient for Linux
if: runner.os == 'Linux'
run: |
sudo apt install isc-dhcp-client
sudo dhclient
# IPv6 is missing on the GitHub macOS image and we need it for the networking facts tests
# https://github.com/actions/runner-images/issues/668
- name: Add IPv6 on macOS
if: runner.os == 'macOS'
run: |
primary_interface=`route -n get default | awk '/interface: */{print $NF}'`
sudo ifconfig $primary_interface inet6 add ::1/64
- name: Run acceptance tests on Linux and MacOS platform
if: runner.os != 'Windows'
run: sudo -E "PATH=$PATH" ruby $FACTER_ROOT/.github/actions/presuite.rb ${{ matrix.os }}
- name: Run acceptance tests on Windows-like platform
if: runner.os == 'Windows'
run: ruby $Env:FACTER_ROOT/.github/actions/presuite.rb ${{ matrix.os }}
integration_tests:
name: Integration on ${{ matrix.cfg.os }} with Ruby ${{ matrix.cfg.ruby }}
strategy:
fail-fast: false
matrix:
cfg:
- {os: ubuntu-latest, ruby: '2.7'}
- {os: ubuntu-22.04, ruby: '3.2'} # with openssl 3
- {os: ubuntu-22.04, ruby: 'jruby-9.3.14.0'}
- {os: ubuntu-latest, ruby: 'jruby-9.4.12.1'}
- {os: ubuntu-latest, ruby: 'jruby-10.0.2.0'}
- {os: windows-2022, ruby: '2.7'}
- {os: windows-2022, ruby: '3.2'} # with openssl 3
runs-on: ${{ matrix.cfg.os }}
env:
BUNDLE_WITH: 'integration'
steps:
- name: Checkout current PR
uses: actions/checkout@v6
- name: Rspec checks
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.cfg.ruby }}
bundler-cache: true
- run: bundle exec rake spec_integration
tests:
if: always()
needs:
- rubocop_and_matrix
- linux_unit_tests
- windows_unit_tests
- acceptance_tests
- integration_tests
runs-on: ubuntu-24.04
name: Test suite
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}