scelint 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/add_new_issue_to_triage_project.yml +40 -0
- data/.github/workflows/pr_tests.yml +42 -0
- data/.github/workflows/tag_deploy_rubygem.yml +212 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +748 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +20 -0
- data/README.md +13 -0
- data/Rakefile +12 -0
- data/exe/scelint +6 -0
- data/lib/scelint/cli.rb +80 -0
- data/lib/scelint/version.rb +5 -0
- data/lib/scelint.rb +716 -0
- data/scelint.gemspec +30 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7d121727337167a02dc39353a853b84f507f4dc6cf5c45c85bbe56d94086e02e
|
4
|
+
data.tar.gz: 3f9b21206628774aaed2d47b6a908fe6be641b5a194dcd23adca977b19832bb4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afaf9b7895df1b77779d97c3bec5ad28f03b706bdc8bf1538f76cab370e30ec0a5c324630796fe861d6ef2db413c079d371f4c854d3d9a0baa28a736fd184e7d
|
7
|
+
data.tar.gz: aeb34f03d6970e7947dfb9b4c501e9ca902d9d92ea2d68ff96bfc78439eec526edeac4fb53ad845e8029821cad699b86bd9525eef817e8ea5ef1da284ea824ec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Add new issues to triage project board (https://github.com/orgs/simp/projects/11)
|
2
|
+
# ------------------------------------------------------------------------------
|
3
|
+
#
|
4
|
+
# NOTICE: **This file is maintained with puppetsync**
|
5
|
+
#
|
6
|
+
# This file is updated automatically as part of a puppet module baseline.
|
7
|
+
#
|
8
|
+
# The next baseline sync will overwrite any local changes to this file!
|
9
|
+
#
|
10
|
+
# ==============================================================================
|
11
|
+
# This pipeline uses the following GitHub Action Secrets:
|
12
|
+
#
|
13
|
+
# GitHub Secret variable Notes
|
14
|
+
# ------------------------------- ---------------------------------------
|
15
|
+
# AUTO_TRIAGE_TOKEN Token with appropriate permissions
|
16
|
+
#
|
17
|
+
# ------------------------------------------------------------------------------
|
18
|
+
#
|
19
|
+
#
|
20
|
+
---
|
21
|
+
name: Add new issues to triage project
|
22
|
+
|
23
|
+
'on':
|
24
|
+
issues:
|
25
|
+
types:
|
26
|
+
- opened
|
27
|
+
- reopened
|
28
|
+
pull_request_target:
|
29
|
+
types:
|
30
|
+
- opened
|
31
|
+
|
32
|
+
jobs:
|
33
|
+
add-to-project:
|
34
|
+
name: Add issue to project
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
steps:
|
37
|
+
- uses: actions/add-to-project@v0.5.0
|
38
|
+
with:
|
39
|
+
project-url: https://github.com/orgs/simp/projects/11
|
40
|
+
github-token: ${{ secrets.AUTO_TRIAGE_TOKEN }}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
name: PR Tests
|
3
|
+
|
4
|
+
'on':
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
ruby-style:
|
13
|
+
name: 'Ruby Style'
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: "Install Ruby"
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 3.3
|
21
|
+
bundler-cache: true
|
22
|
+
- run: bundle exec rake rubocop
|
23
|
+
|
24
|
+
spec-tests:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
name: Ruby ${{ matrix.ruby }}
|
27
|
+
strategy:
|
28
|
+
matrix:
|
29
|
+
ruby:
|
30
|
+
- '2.7' # Puppet 7
|
31
|
+
- '3.2' # Puppet 8
|
32
|
+
- '3.3' # Latest
|
33
|
+
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v3
|
36
|
+
- name: Set up Ruby
|
37
|
+
uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
bundler-cache: true
|
41
|
+
- name: Spec tests
|
42
|
+
run: bundle exec rake spec
|
@@ -0,0 +1,212 @@
|
|
1
|
+
# Create GitHub release, build & publish .gem to rubygems.org on SemVer tag push
|
2
|
+
#
|
3
|
+
# This workflow's jobs are only triggered in repos under the `simp` organization
|
4
|
+
# ------------------------------------------------------------------------------
|
5
|
+
#
|
6
|
+
# NOTICE: **This file is maintained with puppetsync**
|
7
|
+
#
|
8
|
+
# This file is updated automatically as part of a standardized asset baseline.
|
9
|
+
#
|
10
|
+
# The next baseline sync will overwrite any local changes to this file!
|
11
|
+
#
|
12
|
+
# ==============================================================================
|
13
|
+
#
|
14
|
+
# This pipeline uses the following GitHub Action Secrets:
|
15
|
+
#
|
16
|
+
# GitHub Secret variable Type Notes
|
17
|
+
# ------------------------ -------- ----------------------------------------
|
18
|
+
# RUBYGEMS_API_KEY Required
|
19
|
+
#
|
20
|
+
# ------------------------------------------------------------------------------
|
21
|
+
#
|
22
|
+
# NOTES:
|
23
|
+
#
|
24
|
+
# * The CHANGELOG text is altered to remove RPM-style date headers, which don't
|
25
|
+
# render well as markdown on the GitHub release pages
|
26
|
+
#
|
27
|
+
# * By default, the gem is built and released using the standard rake tasks
|
28
|
+
# from "bundler/gem_tasks". To override these, create a JSON file at
|
29
|
+
# `.github/workflows.local.json`, using the following format:
|
30
|
+
#
|
31
|
+
# {
|
32
|
+
# "gem_build_command": "bundle exec rake build",
|
33
|
+
# "gem_release_command": "bundle exec rake build release:rubygem_push",
|
34
|
+
# "gem_pkg_dir": "pkg"
|
35
|
+
# }
|
36
|
+
#
|
37
|
+
# All keys are optional.
|
38
|
+
#
|
39
|
+
---
|
40
|
+
name: 'Tag: Release to GitHub + rubygems.org (no RPMS)'
|
41
|
+
|
42
|
+
'on':
|
43
|
+
push:
|
44
|
+
tags:
|
45
|
+
# NOTE: These filter patterns aren't actually regexes:
|
46
|
+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
|
47
|
+
- '[0-9]+\.[0-9]+\.[0-9]+'
|
48
|
+
- '[0-9]+\.[0-9]+\.[0-9]+\-[a-z]+[0-9]+'
|
49
|
+
|
50
|
+
env:
|
51
|
+
PUPPET_VERSION: '~> 8'
|
52
|
+
LOCAL_WORKFLOW_CONFIG_FILE: .github/workflows.local.json
|
53
|
+
|
54
|
+
jobs:
|
55
|
+
releng-checks:
|
56
|
+
name: "RELENG checks"
|
57
|
+
if: github.repository_owner == 'simp'
|
58
|
+
runs-on: ubuntu-latest
|
59
|
+
outputs:
|
60
|
+
build_command: ${{ steps.commands.outputs.build_command }}
|
61
|
+
release_command: ${{ steps.commands.outputs.release_command }}
|
62
|
+
pkg_dir: ${{ steps.commands.outputs.pkg_dir }}
|
63
|
+
steps:
|
64
|
+
- name: "Assert '${{ github.ref }}' is a tag"
|
65
|
+
run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
|
66
|
+
- uses: actions/checkout@v3
|
67
|
+
with:
|
68
|
+
ref: ${{ github.ref }}
|
69
|
+
clean: true
|
70
|
+
- name: Determine build and release commands
|
71
|
+
id: commands
|
72
|
+
run: |
|
73
|
+
# By default, this is the standard task from "bundler/gem_tasks"
|
74
|
+
# To override it, add the new command to LOCAL_WORKFLOW_CONFIG_FILE
|
75
|
+
GEM_BUILD_COMMAND='bundle exec rake build'
|
76
|
+
GEM_RELEASE_COMMAND='bundle exec rake build release:rubygem_push'
|
77
|
+
GEM_PKG_DIR='pkg'
|
78
|
+
if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
|
79
|
+
grep -w '"gem_pkg_dir"' &> /dev/null; then
|
80
|
+
GEM_PKG_DIR="$(jq -r .gem_pkg_dir "$LOCAL_WORKFLOW_CONFIG_FILE" )"
|
81
|
+
fi
|
82
|
+
if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
|
83
|
+
grep -w '"gem_build_command"' &> /dev/null; then
|
84
|
+
GEM_BUILD_COMMAND="$(jq -r .gem_build_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
|
85
|
+
fi
|
86
|
+
if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
|
87
|
+
grep -w '"gem_release_command"' &> /dev/null; then
|
88
|
+
GEM_RELEASE_COMMAND="$(jq -r .gem_release_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
|
89
|
+
fi
|
90
|
+
echo "build_command=$GEM_BUILD_COMMAND" | tee -a "$GITHUB_OUTPUT"
|
91
|
+
echo "pkg_dir=$GEM_PKG_DIR" | tee -a "$GITHUB_OUTPUT"
|
92
|
+
echo "release_command=$GEM_RELEASE_COMMAND" | tee -a "$GITHUB_OUTPUT"
|
93
|
+
- uses: ruby/setup-ruby@v1
|
94
|
+
with:
|
95
|
+
ruby-version: 2.7
|
96
|
+
bundler-cache: true
|
97
|
+
- name: Test build the package
|
98
|
+
run: "${{ steps.commands.outputs.build_command }}"
|
99
|
+
- name: "Assert '${{ github.ref }}' matches the package version"
|
100
|
+
run: |
|
101
|
+
tag="${GITHUB_REF/refs\/tags\//}"
|
102
|
+
[ -d "${{ steps.commands.outputs.pkg_dir }}" ] || \
|
103
|
+
{ echo "::error ::No directory found at ${{ steps.commands.outputs.pkg_dir }}/" ; exit 3 ; }
|
104
|
+
ls -1 "${{ steps.commands.outputs.pkg_dir }}"/*.gem || \
|
105
|
+
{ echo "::error ::No gem file found at ${{ steps.commands.outputs.pkg_dir }}/*.gem" ; exit 2 ; }
|
106
|
+
[ -f "${{ steps.commands.outputs.pkg_dir }}"/*-${tag}.gem ] || \
|
107
|
+
{ echo "::error ::tag '${tag}' does not match package $(ls -1 ${{ steps.commands.outputs.pkg_dir }}/*.gem)"; exit 1 ; }
|
108
|
+
|
109
|
+
create-github-release:
|
110
|
+
name: Deploy GitHub Release
|
111
|
+
needs:
|
112
|
+
- releng-checks
|
113
|
+
if: github.repository_owner == 'simp'
|
114
|
+
runs-on: ubuntu-latest
|
115
|
+
outputs:
|
116
|
+
prerelease: ${{ steps.tag-check.outputs.prerelease }}
|
117
|
+
tag: ${{ steps.tag-check.outputs.tag }}
|
118
|
+
steps:
|
119
|
+
- name: Checkout code
|
120
|
+
uses: actions/checkout@v3
|
121
|
+
with:
|
122
|
+
ref: ${{ github.ref }}
|
123
|
+
clean: true
|
124
|
+
fetch-depth: 0
|
125
|
+
|
126
|
+
- name: Get tag & annotation info (${{github.ref}})
|
127
|
+
id: tag-check
|
128
|
+
run: |
|
129
|
+
tag="${GITHUB_REF/refs\/tags\//}"
|
130
|
+
annotation="$(git for-each-ref "$GITHUB_REF" --format='%(contents)' --count=1)"
|
131
|
+
annotation_title="$(echo "$annotation" | head -1)"
|
132
|
+
|
133
|
+
if [[ "$tag" =~ ^(simp-|v)?[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta|pre|post)?([0-9]+)?)?$ ]]; then
|
134
|
+
if [ -n "${BASH_REMATCH[2]}" ]; then
|
135
|
+
prerelease=yes
|
136
|
+
annotation_title="Pre-release of ${tag}"
|
137
|
+
fi
|
138
|
+
else
|
139
|
+
printf '::error ::Release Tag format is not SemVer, X.Y.Z-R, X.Y.Z-<prerelease>: "%s"\n' "$RELEASE_TAG"
|
140
|
+
exit 88
|
141
|
+
fi
|
142
|
+
|
143
|
+
echo "tag=$tag" | tee -a "$GITHUB_OUTPUT"
|
144
|
+
echo "prerelease=$prerelease" | tee -a "$GITHUB_OUTPUT"
|
145
|
+
echo "TARGET_TAG=$tag" | tee -a "$GITHUB_ENV"
|
146
|
+
|
147
|
+
# Prepare annotation body as a file for the next step
|
148
|
+
#
|
149
|
+
# * The GitHub Release renders the text in this file as markdown
|
150
|
+
# * The `perl -pe` removes RPM-style date headers from the CHANGELOG,
|
151
|
+
# because they don't render well as markdown on the Release page
|
152
|
+
echo "RELEASE_MESSAGE<<EOF$$" >> "$GITHUB_ENV"
|
153
|
+
printf '%s\n\n' "$annotation_title" >> "$GITHUB_ENV"
|
154
|
+
echo "$annotation" | tail -n +2 | \
|
155
|
+
perl -pe 'BEGIN{undef $/;} s/\n\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun) .*?\n//smg;' >> "$GITHUB_ENV"
|
156
|
+
echo "EOF$$" >> "$GITHUB_ENV"
|
157
|
+
|
158
|
+
- name: Create Release
|
159
|
+
id: create_release
|
160
|
+
env:
|
161
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
162
|
+
IS_PRERELEASE: ${{ steps.tag-check.outputs.prerelease }}
|
163
|
+
run: |
|
164
|
+
echo "${RELEASE_MESSAGE}" > /tmp/.commit-msg.txt
|
165
|
+
args=(-F /tmp/.commit-msg.txt)
|
166
|
+
[[ "$IS_PRERELEASE" == yes ]] && args+=(--prerelease)
|
167
|
+
|
168
|
+
gh release create ${args[@]} "$TARGET_TAG"
|
169
|
+
|
170
|
+
deploy-rubygem:
|
171
|
+
name: Deploy RubyGem Release
|
172
|
+
needs:
|
173
|
+
- releng-checks
|
174
|
+
- create-github-release
|
175
|
+
if: (github.repository_owner == 'simp') && (needs.create-github-release.outputs.prerelease != 'yes')
|
176
|
+
runs-on: ubuntu-latest
|
177
|
+
env:
|
178
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
179
|
+
BUILD_COMMAND: ${{ needs.releng-checks.outputs.build_command }}
|
180
|
+
RELEASE_COMMAND: ${{ needs.releng-checks.outputs.release_command }}
|
181
|
+
PKG_DIR: ${{ needs.releng-checks.outputs.pkg_dir }}
|
182
|
+
steps:
|
183
|
+
- name: Checkout code
|
184
|
+
uses: actions/checkout@v3
|
185
|
+
with:
|
186
|
+
ref: ${{ github.ref }}
|
187
|
+
clean: true
|
188
|
+
- uses: ruby/setup-ruby@v1
|
189
|
+
with:
|
190
|
+
ruby-version: 2.7
|
191
|
+
bundler-cache: true
|
192
|
+
- name: Build RubyGem
|
193
|
+
run: |
|
194
|
+
echo "Setting up file permissions..."
|
195
|
+
chmod -R go=u-w .
|
196
|
+
|
197
|
+
echo "Running '$BUILD_COMMAND'..."
|
198
|
+
$BUILD_COMMAND
|
199
|
+
|
200
|
+
- name: Release RubyGem
|
201
|
+
run: |
|
202
|
+
echo "Setting up gem credentials..."
|
203
|
+
mkdir -p ~/.gem
|
204
|
+
|
205
|
+
cat << EOF > ~/.gem/credentials
|
206
|
+
---
|
207
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
208
|
+
EOF
|
209
|
+
chmod 0600 ~/.gem/credentials
|
210
|
+
|
211
|
+
echo "Running '$RELEASE_COMMAND'..."
|
212
|
+
$RELEASE_COMMAND
|
data/.gitignore
ADDED
data/.rspec
ADDED