Skip to content

[puppetsync] Clean up for linters #94

[puppetsync] Clean up for linters

[puppetsync] Clean up for linters #94

Workflow file for this run

# Run checks and test matrix on Pull Requests
# ==============================================================================
#
# The testing matrix considers ruby/puppet versions supported by SIMP and PE:
# ------------------------------------------------------------------------------
# Release Puppet Ruby EOL
# PE 2021.Y 7.x 2.7 Quarterly updates
# PE 2023.Y 8.x 3.2 Quarterly updates
#
# https://www.puppet.com/docs/pe/latest/component_versions_in_recent_pe_releases.html
# https://www.puppet.com/products/puppet-enterprise/support-lifecycle
# https://www.puppet.com/docs/pe/latest/getting_support_for_pe
# ==============================================================================
#
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
#
name: PR Tests
on:
push:
branches:
# A test branch for seeing if your tests will pass in your personal fork
- test_me_github
pull_request:
types: [opened, reopened, synchronize]
jobs:
ruby-style:
if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml
name: 'Ruby Style (experimental)'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: |
bundle show
bundle exec rake rubocop
releng-checks:
name: 'RELENG checks'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: 'Ensure executables are installed'
run: |
command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:
command -v rpm || { >&2 echo "FATAL: Cannot find executable: ''rpm''"; exit 1 ;}
- name: 'Tags and changelogs'
run: |
bundle exec rake pkg:check_version
bundle exec rake pkg:compare_latest_tag
bundle exec rake pkg:create_tag_changelog
- name: 'Validate Ruby version'
run: 'bundle exec rake pkg:validate_ruby_version'
- name: 'Test-build the RubyGem'
run: 'bundle exec rake pkg:gem'
spec-tests:
name: 'RSpec'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
puppet:
- label: 'Puppet 7.x'
puppet_version: '~> 7.0'
ruby_version: '2.7'
- label: 'Puppet 8.x'
puppet_version: '~> 8.0'
ruby_version: '3.2'
env:
PUPPET_VERSION: '${{matrix.puppet.puppet_version}}'
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.puppet.ruby_version}}
bundler-cache: true
# simp cli code uses libpwquality or cracklib to validate passwords and
# rsync in simp environment commands
- run: |
sudo apt-get update
sudo apt-get install -y rpm cracklib-runtime libicu-dev rsync
# simp config uses grub2-mkpasswd-pbkdf2 when encrypting a GRUB password,
# but the command has a different name on Ubuntu
- run: |
sudo ln -s /usr/bin/grub-mkpasswd-pbkdf2 /usr/bin/grub2-mkpasswd-pbkdf2
ls -l /usr/bin | grep grub
# simp cli code fetches USER env variable. In the docker container USER is
# not available, but the process is running as root.
- run: 'USER=root SIMP_SKIP_NON_SIMPOS_TESTS=1 bundle exec rake spec'
env:
SKIP_COVERAGE: yes
# dump_contexts:
# name: 'Examine Context contents'
# runs-on: ubuntu-16.04
# steps:
# - name: Dump contexts
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo "$GITHUB_CONTEXT"
#