puppetlabs/facter

View on GitHub
.github/workflows/acceptance_tests.yml

Summary

Maintainability
Test Coverage
---
name: Acceptance tests

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  acceptance_tests:
    name: Platform
    strategy:
      matrix:
        os: [ windows-2019, ubuntu-20.04, macos-12 ]
    runs-on: ${{ matrix.os }}
    env:
      BEAKER_debug: true
      FACTER_ROOT: facter
      SHA: latest
      RELEASE_STREAM: puppet7

    steps:
      - name: Checkout current PR
        uses: actions/checkout@v4
        with:
          path: facter

      - name: Install Ruby 2.7
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.7'
          rubygems: '3.3.26'

      - 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 dhcpcd5
          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-like 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 }}