puppetlabs/facter-ng

View on GitHub
.github/workflows/acceptance_tests.yml

Summary

Maintainability
Test Coverage
---
name: Acceptance tests

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  acceptance_tests:
    name: Platform
    strategy:
      matrix:
        os: [windows-2016, windows-2019, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-10.15]
    runs-on: ${{ matrix.os }}
    env:
      FACTER_3_ROOT: facter_3
      FACTER_4_ROOT: facter_4
      SHA: latest

    steps:
      - name: Checkout current PR
        uses: actions/checkout@v2
        with:
          path: facter_4

      - name: Clone facter 3 repo
        uses: actions/checkout@v2
        with:
          repository: puppetlabs/facter
          ref: github_acceptance_tests
          path: facter_3

      - name: Install Ruby 2.6
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.6'

      - 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 /usr/share/rust /home/runner/.config /home/linuxbrew

      - name: Instal dhclient for Linux
        if: runner.os == 'Linux'
        run: |
          sudo apt install dhcpcd5
          sudo dhclient

      - name: Run acceptance tests on Linux like platform
        if: runner.os != 'Windows'
        run: sudo -E "PATH=$PATH" ruby $FACTER_4_ROOT/.github/actions/presuite.rb ${{ matrix.os }}

      - name: Run acceptance tests on Windows like platform
        if: runner.os == 'Windows'
        run: ruby $Env:FACTER_4_ROOT/.github/actions/presuite.rb ${{ matrix.os }}