Skip to content

Commit

Permalink
enable GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenki committed Aug 13, 2024
1 parent 3f42234 commit 78f2c6f
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 22 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: ci

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
check:
strategy:
fail-fast: false
matrix:
puppet_version: [7]

name: Check / Puppet ${{ matrix.puppet_version }}
runs-on: ubuntu-22.04
container: puppet/pdk:latest

steps:
- name: Install build-essential
run: |
export DEBIAN_FRONTEND=noninteractive;
apt-get --yes update
apt-get --yes install build-essential
- name: Checkout
uses: actions/checkout@v4

- name: Run pdk validate
run: pdk validate --format=text --puppet-version ${{ matrix.puppet_version }}

- name: Run pdk test unit
run: pdk test unit --format=text --puppet-version ${{ matrix.puppet_version }}

acceptance:
strategy:
fail-fast: false
matrix:
os: ['rocky8', 'ub2204', 'deb11']
puppet_version: [7]

name: Acceptance / ${{ matrix.os }} / Puppet ${{ matrix.puppet_version }}
runs-on: ubuntu-22.04
needs:
- check

steps:
- name: Enable IPv6 on docker
run: |
echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
- name: Checkout
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true

- name: Run Litmus
env:
DEBUG: true
run: |
bundle exec rake 'litmus:provision_list[gha_${{ matrix.os }}]'
bundle exec rake 'litmus:install_agent[puppet${{ matrix.puppet_version }}]'
bundle exec rake litmus:install_module
bundle exec rake litmus:acceptance:parallel
- name: Cleanup
run: |
bundle exec rake 'litmus:tear_down'
57 changes: 52 additions & 5 deletions provision.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,55 @@
---
default:
provisioner: docker_exp
images: ['waffleimage/centos7']
vagrant:
provisioner: vagrant
params:
hyperv_smb_username: someone
hyperv_smb_password: something
images:
- bento/centos-7.7
images: ['centos/7', 'generic/ubuntu2004']

deb_all:
provisioner: docker
images: ['litmusimage/debian:10', 'litmusimage/debian:11']
el_all:
provisioner: docker
images: ['litmusimage/centos:7', 'litmusimage/centos:8']
# The most reliable workaround for the docker/systemd incompatibility.
# see https://github.com/docker/for-linux/issues/835
# see https://github.com/moby/moby/issues/38749
vars: '{docker_run_opts: ["-v /sys/fs/cgroup:/sys/fs/cgroup:ro"]}'
ub_all:
provisioner: docker
images: ['litmusimage/ubuntu:20.04', 'litmusimage/ubuntu:22.04']

gha_deb10:
provisioner: docker
images: ['litmusimage/debian:10']
gha_deb11:
provisioner: docker
images: ['litmusimage/debian:11']
gha_el7:
provisioner: docker
images: ['litmusimage/centos:7']
# The most reliable workaround for the docker/systemd incompatibility.
# see https://github.com/docker/for-linux/issues/835
# see https://github.com/moby/moby/issues/38749
vars: '{docker_run_opts: ["-v /sys/fs/cgroup:/sys/fs/cgroup:ro"]}'
gha_el8:
provisioner: docker
images: ['litmusimage/centos:8']
# The most reliable workaround for the docker/systemd incompatibility.
# see https://github.com/docker/for-linux/issues/835
# see https://github.com/moby/moby/issues/38749
vars: '{docker_run_opts: ["-v /sys/fs/cgroup:/sys/fs/cgroup:ro"]}'
gha_rocky8:
provisioner: docker
images: ['litmusimage/rockylinux:8']
# The most reliable workaround for the docker/systemd incompatibility.
# see https://github.com/docker/for-linux/issues/835
# see https://github.com/moby/moby/issues/38749
#vars: '{docker_run_opts: ["-v /sys/fs/cgroup:/sys/fs/cgroup:ro"]}'
gha_ub2004:
provisioner: docker
images: ['litmusimage/ubuntu:20.04']
gha_ub2204:
provisioner: docker
images: ['litmusimage/ubuntu:22.04']
5 changes: 2 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@
next unless File.exist?(f) && File.readable?(f) && File.size?(f)

begin
require 'deep_merge'
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
rescue StandardError => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
end

# read default_facts and merge them over what is provided by facterdb
default_facts.each do |fact, value|
add_custom_fact fact, value, merge_facts: true
add_custom_fact fact, value
end

RSpec.configure do |c|
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'puppet_litmus'
PuppetLitmus.configure!

require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))

PuppetLitmus.configure!
12 changes: 0 additions & 12 deletions spec/spec_helper_acceptance_local.rb

This file was deleted.

0 comments on commit 78f2c6f

Please sign in to comment.