-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Brian J. Murrell <brian.murrell@intel.com>
- Loading branch information
1 parent
a1aa731
commit 82c24f5
Showing
6 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Have Release Engineering added as a reviewer to any GitHub Actions | ||
* @daos-stack/actions-watchers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: bash_unit Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
bash-unit-testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Unit testing with bash_unit | ||
run: | | ||
curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh | bash | ||
FORCE_COLOR=true ./bash_unit tests/test_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Linting | ||
|
||
# Always run on Pull Requests as then these checks can be marked as required. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
shell-check: | ||
name: ShellCheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Add error parser | ||
run: echo -n "::add-matcher::shellcheck-matcher.json" | ||
- name: Run ShellCheck | ||
uses: ludeeus/action-shellcheck@2.0.0 | ||
with: | ||
format: gcc | ||
|
||
linting-summary: | ||
name: Linting Summary | ||
runs-on: ubuntu-22.04 | ||
needs: [shell-check] | ||
if: (!cancelled()) | ||
steps: | ||
- name: Check if any job failed | ||
run: | | ||
if [[ -z "$(echo "${{ join(needs.*.result, '') }}" | sed -e 's/success//g')" ]]; then | ||
echo "All jobs succeeded" | ||
else | ||
echo "One or more jobs did not succeed" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
sed -Ene 's/^([-[:alnum:]]+): *([-<@>,\._ [:alnum:]]+)$/\1 \2/p' | while read -r a b; do | ||
echo -n "${a//-/_}" | tr '[:lower:]' '[:upper:]' | ||
# escape special characters in the value | ||
echo "=$b" | sed -e 's/\([<> ]\)/\\\1/g' | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "shellcheck-problem-matcher", | ||
"severity": "error", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error|note):\\s+(.*)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 5 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
test_get_commit_pragmas() { | ||
local msg='Use external action | ||
Run-GHA: true | ||
Skip-PR-comments: true | ||
Test-tag: always_passes,vm | ||
Required-githooks: true | ||
Signed-off-by: Brian J. Murrell <brian.murrell@intel.com> | ||
' | ||
assert_equals "$(echo "$msg" | ../get_commit_pragmas)" 'RUN_GHA=true | ||
SKIP_PR_COMMENTS=true | ||
TEST_TAG=always_passes,vm | ||
REQUIRED_GITHOOKS=true | ||
SIGNED_OFF_BY=Brian\ J.\ Murrell\ \<brian.murrell@intel.com\>' | ||
|
||
local msg='Escape spaces also | ||
'"'"'Will-not-be-a-pragma: false'"'"' should not be considered a commit | ||
pragma, but: | ||
Should-not-be-a-pragma: bar will be because it was not quoted. | ||
Skip-func-test-leap15: false | ||
RPM-test-version: 2.5.100-13.10036.g65926e32 | ||
Skip-PR-comments: true | ||
Test-tag: always_passes always_fails | ||
EL8-VM9-label: all_vm9 | ||
EL9-VM9-label: all_vm9 | ||
Leap15-VM9-label: all_vm9 | ||
HW-medium-label: new_icx5 | ||
HW-large-label: new_icx9 | ||
Required-githooks: true | ||
Signed-off-by: Brian J. Murrell <brian.murrell@intel.com> | ||
' | ||
assert_equals "$(echo "$msg" | ../get_commit_pragmas)" 'SHOULD_NOT_BE_A_PRAGMA=bar\ will\ be\ because\ it\ was\ not\ quoted. | ||
SKIP_FUNC_TEST_LEAP15=false | ||
RPM_TEST_VERSION=2.5.100-13.10036.g65926e32 | ||
SKIP_PR_COMMENTS=true | ||
TEST_TAG=always_passes\ always_fails | ||
EL8_VM9_LABEL=all_vm9 | ||
EL9_VM9_LABEL=all_vm9 | ||
LEAP15_VM9_LABEL=all_vm9 | ||
HW_MEDIUM_LABEL=new_icx5 | ||
HW_LARGE_LABEL=new_icx9 | ||
REQUIRED_GITHOOKS=true | ||
SIGNED_OFF_BY=Brian\ J.\ Murrell\ \<brian.murrell@intel.com\>' | ||
|
||
} |