1+ # This is a generic workflow for Puppet module CI operations.
2+ name : " Module CI"
3+
4+ on :
5+ workflow_call :
6+ inputs :
7+ runs_on :
8+ description : " The operating system used for the runner."
9+ required : false
10+ default : " ubuntu-latest"
11+ type : " string"
12+ flags :
13+ description : " Additional flags to pass to matrix_from_metadata_v2."
14+ required : false
15+ default : ' '
16+ type : " string"
17+
18+
19+ jobs :
20+ setup_matrix :
21+ name : " Setup Test Matrix"
22+ runs-on : ${{ inputs.runs_on }}
23+ outputs :
24+ spec_matrix : ${{ steps.get-matrix.outputs.spec_matrix }}
25+
26+ env :
27+ BUNDLE_WITHOUT : release_prep
28+
29+ steps :
30+
31+ - name : " Checkout"
32+ uses : " actions/checkout@v4"
33+ with :
34+ ref : ${{ github.event.pull_request.head.sha }}
35+
36+ - name : " Setup ruby"
37+ uses : " ruby/setup-ruby@v1"
38+ with :
39+ ruby-version : " 2.7"
40+ bundler-cache : true
41+
42+ - name : " Bundle environment"
43+ run : |
44+ echo ::group::bundler environment
45+ bundle env
46+ echo ::endgroup::
47+
48+ - name : Setup Spec Test Matrix
49+ id : get-matrix
50+ run : |
51+ bundle exec matrix_from_metadata_v2 ${{ inputs.flags }}
52+
53+ spec :
54+ name : " Spec tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
55+ needs : " setup_matrix"
56+ runs-on : ${{ inputs.runs_on }}
57+ strategy :
58+ fail-fast : false
59+ matrix : ${{ fromJson( needs.setup_matrix.outputs.spec_matrix ) }}
60+
61+ env :
62+ BUNDLE_WITHOUT : release_prep
63+ PUPPET_GEM_VERSION : ${{ matrix.puppet_version }}
64+ FACTER_GEM_VERSION : ' https://github.com/puppetlabs/facter#main' # why is this set?
65+
66+ steps :
67+ - name : " Checkout"
68+ uses : " actions/checkout@v4"
69+ with :
70+ ref : ${{ github.event.pull_request.head.sha }}
71+
72+ - name : " Setup ruby"
73+ uses : " ruby/setup-ruby@v1"
74+ with :
75+ ruby-version : ${{matrix.ruby_version}}
76+ bundler-cache : true
77+
78+ - name : " Bundle environment"
79+ run : |
80+ echo ::group::bundler environment
81+ bundle env
82+ echo ::endgroup::
83+
84+ - name : " Run Static & Syntax Tests"
85+ run : |
86+ bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
87+ bundle exec dependency-checker metadata.json --override WhatsARanjit/node_manager,0.7.5
88+
89+
90+ - name : " Run tests"
91+ run : |
92+ bundle exec rake parallel_spec
0 commit comments