diff --git a/.github/workflows/check-chart-push.yml b/.github/workflows/check-chart-push.yml index 712aa26bb..81a688c7e 100644 --- a/.github/workflows/check-chart-push.yml +++ b/.github/workflows/check-chart-push.yml @@ -6,10 +6,9 @@ on: - "addons/**" - "addons-cluster/**" branches: - - '*' - - '*/*' + - '**' tags-ignore: - - '*' + - '**' jobs: check-addons-helm: diff --git a/.github/workflows/shellcheck-push.yml b/.github/workflows/shellcheck-push.yml index eca7105c6..5b868eea0 100644 --- a/.github/workflows/shellcheck-push.yml +++ b/.github/workflows/shellcheck-push.yml @@ -3,10 +3,9 @@ name: Shell Check on: push: branches: - - '*' - - '*/*' + - '**' tags-ignore: - - '*' + - '**' env: BASE_BRANCH: origin/main diff --git a/.github/workflows/shellspec-pr-review.yml b/.github/workflows/shellspec-pr-review.yml new file mode 100644 index 000000000..bc4e0feca --- /dev/null +++ b/.github/workflows/shellspec-pr-review.yml @@ -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/cancel-workflow-action@0.11.0 + 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 diff --git a/.github/workflows/shellspec-push.yml b/.github/workflows/shellspec-push.yml new file mode 100644 index 000000000..4169f90b6 --- /dev/null +++ b/.github/workflows/shellspec-push.yml @@ -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/cancel-workflow-action@0.11.0 + 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