diff --git a/.github/workflows/ci-e2e.yaml b/.github/workflows/ci-e2e.yaml index c49ebae..33db533 100644 --- a/.github/workflows/ci-e2e.yaml +++ b/.github/workflows/ci-e2e.yaml @@ -8,20 +8,10 @@ on: - "ci_*" tags: - "v[0-9]+.[0-9]+.[0-9]+" - paths-ignore: - - '**.adoc' - - '**.md' - - 'samples/**' - - 'LICENSE' pull_request_target: branches: - main - "release-*" - paths-ignore: - - '**.adoc' - - '**.md' - - 'samples/**' - - 'LICENSE' workflow_dispatch: inputs: ginkgoParallel: @@ -48,6 +38,8 @@ env: jobs: e2e_test_suite: name: E2E Test Suite + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -112,3 +104,40 @@ jobs: run: | echo "Executed using dry run, exiting as failure" exit 1 + + required-checks: + name: CI Required Checks + needs: [ e2e_test_suite ] + if: always() + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: echo '${{ toJSON(needs) }}' | jq -e 'to_entries | all(.value.result == "success")' + + is_path_ignore: + if: always() + name: Check for changes on path_ignore + outputs: + should_ignore: ${{ steps.is_path_ignore.outputs.should_ignore }} + runs-on: + - ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 10 + - id: check_files + name: Get changed files + uses: tj-actions/changed-files@v41 + with: + files: | + LICENSE + file-types: "**.adoc,**.md" + - id: set_output + name: Set output based on only files being changed that should be ignored + run: | + if [[ "${{ steps.check_files.outputs.any_changed }}" == "true" ]] && "${{ steps.check_files.outputs.files }}" != "${{ steps.check_files.outputs.all_changed_files }}"; then + echo "should_ignore=true" >> $GITHUB_ENV + else + echo "should_ignore=false" >> $GITHUB_ENV + fi \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be304b4..ce28c93 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,7 +18,8 @@ on: jobs: lint: name: lint - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -33,7 +34,8 @@ jobs: args: --timeout=5m verify-code: name: Verify code - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -49,7 +51,8 @@ jobs: make verify-code verify-manifests: name: Verify manifests - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -65,7 +68,8 @@ jobs: make verify-manifests verify-bundle: name: Verify bundle - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -81,7 +85,8 @@ jobs: make verify-bundle verify-helm-build: name: Verify helm build - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -97,7 +102,8 @@ jobs: make verify-helm-build verify-imports: name: Verify imports - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -113,7 +119,8 @@ jobs: make verify-imports verify-generate: name: Verify generate - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -129,7 +136,8 @@ jobs: make verify-generate verify-go-mod: name: Verify go.mod - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - name: Set up Go 1.21.x @@ -145,7 +153,8 @@ jobs: make verify-go-mod unit_test_suite: name: Unit Test Suite - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -158,7 +167,8 @@ jobs: make test-unit integration_test_suite: name: Integration Test Suite - if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }} + needs: is_path_ignore + if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -183,7 +193,7 @@ jobs: if: always() name: Check for changes on path_ignore outputs: - ignore: ${{ steps.is_path_ignore.outputs.ignore }} + should_ignore: ${{ steps.is_path_ignore.outputs.should_ignore }} runs-on: - ubuntu-20.04 steps: @@ -196,10 +206,15 @@ jobs: uses: tj-actions/changed-files@v41 with: files: | - samples/** LICENSE file-types: "**.adoc,**.md" - id: set_output - if: steps.check_files.outputs.any_changed == 'true' && steps.check_files.outputs.files != steps.check_files.outputs.all_changed_files name: Set output based on only files being changed that should be ignored - run: echo '::set-output name=ignore=true' + run: | + if [[ "${{ steps.check_files.outputs.any_changed }}" == "true" ]] && "${{ steps.check_files.outputs.files }}" != "${{ steps.check_files.outputs.all_changed_files }}"; then + echo '::set-output name=should_ignore=true' + echo "should_ignore=true" >> $GITHUB_ENV + else + echo '::set-output name=should_ignore=false' + echo "should_ignore=false" >> $GITHUB_ENV + fi