Skip to content

Commit

Permalink
chore: add shellspec ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JashBook committed Sep 4, 2024
1 parent 3d322a8 commit 565968e
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/check-chart-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ on:
- "addons/**"
- "addons-cluster/**"
branches:
- '*'
- '*/*'
- '**'
tags-ignore:
- '*'
- '**'

jobs:
check-addons-helm:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/shellcheck-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name: Shell Check
on:
push:
branches:
- '*'
- '*/*'
- '**'
tags-ignore:
- '*'
- '**'

env:
BASE_BRANCH: origin/main
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/shellspec-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check Chart PR Review

on:
pull_request_review:
paths:
- "addons/*/scripts-ut-spec/**"
types: [submitted]


jobs:
shellspec-test:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
all_but_latest: true
access_token: ${{ env.GITHUB_TOKEN }}

- uses: actions/checkout@v4

- name: shellspec test
run: |
make scripts-test
58 changes: 58 additions & 0 deletions .github/workflows/shellspec-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ShellSpec Test

on:
push:
branches:
- '**'
tags-ignore:
- '**'

env:
BASE_BRANCH: origin/main

jobs:
shellspec-test:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
if: ${{ github.ref_name != 'main' }}
uses: styfle/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
all_but_latest: true
access_token: ${{ env.GITHUB_TOKEN }}

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get base commit id
id: get_base_commit_id
env:
REF_NAME: ${{ github.ref_name }}
run: |
BASE_COMMITID=`bash .github/utils/utils.sh --type 1 \
--branch-name "${{ env.REF_NAME }}" \
--base-branch "${{ env.BASE_BRANCH }}"`
echo "BASE_COMMITID:$BASE_COMMITID"
echo BASE_COMMITID=$BASE_COMMITID >> $GITHUB_ENV
- name: Get file path
id: get_file_path
run: |
FILE_PATH=`git diff --name-only HEAD ${{ env.BASE_COMMITID }}`
echo "FILE_PATH: $FILE_PATH"
SHELL_FILE_PATH=""
for filePath in $(echo "$FILE_PATH"); do
if [[ "${filePath}" == *"addons/"*"/scripts-ut-spec/"* && -f "${filePath}" ]]; then
SHELL_FILE_PATH="${SHELL_FILE_PATH} ${filePath}"
fi
done
echo shell_file_path=$SHELL_FILE_PATH >> $GITHUB_OUTPUT
- name: shellspec test
if: ${{ steps.get_file_path.outputs.shell_file_path }}
run: |
make scripts-test

0 comments on commit 565968e

Please sign in to comment.