Skip to content

CI: Dont set environment vars in backport job #366

CI: Dont set environment vars in backport job

CI: Dont set environment vars in backport job #366

Workflow file for this run

---
name: CI
on:
pull_request: {}
push:
branches:
- main
# minimal permissions
permissions:
contents: read
jobs:
validate_manpage:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# on violations, `man` outputs `warning...` but exit code still stays 0, hence the grep workaround
- run: LC_ALL=C.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z man/man1/facter.1 2>&1 | grep -vz warning
rubocop_and_matrix:
runs-on: ubuntu-24.04
outputs:
ruby: ${{ steps.ruby.outputs.versions }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
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@be0467ce7366d206b2e87f5b7a032a030120b7cb # 2.0.0
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' # used in OpenVox 8
- ruby: 'jruby-9.4.15.0' # OpenVox 8 target https://github.com/OpenVoxProject/jruby-deps/pull/21
- ruby: 'jruby-10.0.5.0' # latest JRuby for Ruby 3.4 compatibility / OpenVox 9 target version
runs-on: ubuntu-24.04
steps:
- name: Checkout current PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# we explictly force Java 17 because that's the lowest one we support when building packages with ezbake
- name: Set up Java 17 for JRuby 9
if: contains(matrix.ruby, 'jruby-9')
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '17'
# JRuby 10.0.5 requires java 21 or 25
- name: Set up Java 21 for JRuby 10
if: contains(matrix.ruby, 'jruby-10')
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '21'
- name: Rspec checks
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake spec_random
windows_unit_tests:
needs:
- rubocop_and_matrix
name: Unit tests on Windows with Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.2'
- '4.0'
fail-fast: false
runs-on: windows-2025
steps:
- name: Checkout current PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Rspec checks
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake spec_random
acceptance_tests:
needs:
- rubocop_and_matrix
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: facter
- name: Install Ruby 3.2
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
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:
needs:
- rubocop_and_matrix
name: Integration on ${{ matrix.cfg.os }} with Ruby ${{ matrix.cfg.ruby }}
strategy:
fail-fast: false
matrix:
cfg:
- {os: ubuntu-24.04, ruby: '3.0'} # support for foreman
- {os: ubuntu-24.04, ruby: '3.1'} # openvox server 7
- {os: ubuntu-26.04, ruby: '3.2'} # openvox agent 8
- {os: ubuntu-26.04, ruby: '3.3'}
- {os: ubuntu-26.04, ruby: '3.4'}
- {os: ubuntu-26.04, ruby: '4.0'} # openvox agent 9
- {os: ubuntu-24.04, ruby: 'jruby-9.4.15.0'} # openvox server 8 target https://github.com/OpenVoxProject/jruby-deps/pull/21
- {os: ubuntu-26.04, ruby: 'jruby-10.0.5.0'} # openvox server 9 target
- {os: ubuntu-26.04, ruby: 'jruby-10.1.1.0'} # openvox server 9 target
- {os: windows-2025, ruby: '3.2'} # openvox agent 8
- {os: windows-2025, ruby: '4.0'} # openvox agent 9
runs-on: ${{ matrix.cfg.os }}
env:
BUNDLE_WITH: 'integration'
steps:
- name: Checkout current PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Rspec checks
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.cfg.ruby }}
bundler-cache: true
- run: bundle exec rake spec_integration
tests:
if: always()
needs:
- validate_manpage
- 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) }}
automerge:
name: Enable auto-merge
if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]')
needs:
- tests
runs-on: ubuntu-24.04
permissions:
contents: write
pull-requests: write
steps:
- name: Enable auto-merge for PR
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: gh pr merge --auto --merge --match-head-commit "$PR_HEAD_SHA" "$PR_URL"