|
| 1 | +# Run Puppet checks and test matrix on Pull Requests |
| 2 | +# ------------------------------------------------------------------------------ |
| 3 | +# NOTICE: **This file is maintained with puppetsync** |
| 4 | +# |
| 5 | +# This file is updated automatically as part of a puppet module baseline. |
| 6 | +# |
| 7 | +# The next baseline sync will overwrite any local changes to this file! |
| 8 | +# |
| 9 | +# ============================================================================== |
| 10 | +# |
| 11 | +# The testing matrix considers ruby/puppet versions supported by SIMP and PE: |
| 12 | +# ------------------------------------------------------------------------------ |
| 13 | +# Release Puppet Ruby EOL |
| 14 | +# PE 2019.8 6.22 2.5 2022-12 (LTS) |
| 15 | +# PE 2021.Y 7.x 2.7 Quarterly updates |
| 16 | +# |
| 17 | +# https://puppet.com/docs/pe/latest/component_versions_in_recent_pe_releases.html |
| 18 | +# https://puppet.com/misc/puppet-enterprise-lifecycle |
| 19 | +# ============================================================================== |
| 20 | +# |
| 21 | +# https://docs.github.com/en/actions/reference/events-that-trigger-workflows |
| 22 | +# |
| 23 | + |
| 24 | +name: PR Tests |
| 25 | +on: |
| 26 | + pull_request: |
| 27 | + types: [opened, reopened, synchronize] |
| 28 | + |
| 29 | +env: |
| 30 | + PUPPET_VERSION: '~> 7' |
| 31 | + |
| 32 | +jobs: |
| 33 | + puppet-syntax: |
| 34 | + name: 'Puppet Syntax' |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v3 |
| 38 | + - name: "Install Ruby ${{matrix.puppet.ruby_version}}" |
| 39 | + uses: ruby/setup-ruby@v1 # ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 |
| 40 | + with: |
| 41 | + ruby-version: 2.7 |
| 42 | + bundler-cache: true |
| 43 | + - run: "bundle exec rake syntax" |
| 44 | + |
| 45 | + puppet-style: |
| 46 | + name: 'Puppet Style' |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + - name: "Install Ruby ${{matrix.puppet.ruby_version}}" |
| 51 | + uses: ruby/setup-ruby@v1 |
| 52 | + with: |
| 53 | + ruby-version: 2.7 |
| 54 | + bundler-cache: true |
| 55 | + - run: "bundle exec rake lint" |
| 56 | + - run: "bundle exec rake metadata_lint" |
| 57 | + |
| 58 | + ruby-style: |
| 59 | + if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml |
| 60 | + name: 'Ruby Style (experimental)' |
| 61 | + runs-on: ubuntu-latest |
| 62 | + continue-on-error: true |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v3 |
| 65 | + - name: "Install Ruby ${{matrix.puppet.ruby_version}}" |
| 66 | + uses: ruby/setup-ruby@v1 |
| 67 | + with: |
| 68 | + ruby-version: 2.7 |
| 69 | + bundler-cache: true |
| 70 | + - run: | |
| 71 | + bundle show |
| 72 | + bundle exec rake rubocop |
| 73 | +
|
| 74 | + file-checks: |
| 75 | + name: 'File checks' |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v3 |
| 79 | + - name: 'Install Ruby 2.7' |
| 80 | + uses: ruby/setup-ruby@v1 |
| 81 | + with: |
| 82 | + ruby-version: 2.7 |
| 83 | + bundler-cache: true |
| 84 | + - run: bundle exec rake check:dot_underscore |
| 85 | + - run: bundle exec rake check:test_file |
| 86 | + |
| 87 | + releng-checks: |
| 88 | + name: 'RELENG checks' |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v3 |
| 92 | + - name: 'Install Ruby ${{matrix.puppet.ruby_version}}' |
| 93 | + uses: ruby/setup-ruby@v1 |
| 94 | + with: |
| 95 | + ruby-version: 2.7 |
| 96 | + bundler-cache: true |
| 97 | + - name: 'Tags and changelogs' |
| 98 | + run: | |
| 99 | + bundle exec rake pkg:check_version |
| 100 | + bundle exec rake pkg:compare_latest_tag[,true] |
| 101 | + bundle exec rake pkg:create_tag_changelog |
| 102 | + - name: 'Test-build the Puppet module' |
| 103 | + run: 'bundle exec pdk build --force' |
| 104 | + |
| 105 | + spec-tests: |
| 106 | + name: 'Puppet Spec' |
| 107 | + needs: [puppet-syntax] |
| 108 | + runs-on: ubuntu-latest |
| 109 | + strategy: |
| 110 | + matrix: |
| 111 | + puppet: |
| 112 | + - label: 'Puppet 7.x [SIMP 6.6/PE 2021.7]' |
| 113 | + puppet_version: '~> 7.0' |
| 114 | + ruby_version: '2.7' |
| 115 | + experimental: false |
| 116 | + - label: 'Puppet 8.x' |
| 117 | + puppet_version: '~> 8.0' |
| 118 | + ruby_version: '3.2' |
| 119 | + experimental: false |
| 120 | + fail-fast: false |
| 121 | + env: |
| 122 | + PUPPET_VERSION: ${{matrix.puppet.puppet_version}} |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@v3 |
| 125 | + - name: 'Install Ruby ${{matrix.puppet.ruby_version}}' |
| 126 | + uses: ruby/setup-ruby@v1 |
| 127 | + with: |
| 128 | + ruby-version: ${{matrix.puppet.ruby_version}} |
| 129 | + bundler-cache: true |
| 130 | + - run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:' |
| 131 | + - run: 'bundle exec rake spec' |
| 132 | + continue-on-error: ${{matrix.puppet.experimental}} |
| 133 | + |
| 134 | +# dump_contexts: |
| 135 | +# name: 'Examine Context contents' |
| 136 | +# runs-on: ubuntu-latest |
| 137 | +# steps: |
| 138 | +# - name: Dump contexts |
| 139 | +# env: |
| 140 | +# GITHUB_CONTEXT: ${{ toJson(github) }} |
| 141 | +# run: echo "$GITHUB_CONTEXT" |
| 142 | +# |
0 commit comments