diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 830043a08286..35857baed4a5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,8 +33,7 @@ jobs: pull-requests: read # Set job outputs to values from filter step outputs: - src: ${{ steps.filter.outputs.src }} - ci: ${{ steps.filter.outputs.ci }} + units: ${{ steps.filter.outputs.src == 'true' || steps.filter.outputs.ci == 'true' }} # runnable is true if there are changes outside the .github/workflows directory OR if ci.yaml itself (or kokoro scripts) is modified. runnable: ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) || fromJSON(steps.filter.outputs.ci_count) > 0 }} steps: @@ -62,22 +61,26 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 90 needs: generated-libraries-filter + # Keep the condition on steps (not the job) so matrix checks expand for branch protection. strategy: fail-fast: false matrix: java: [11, 17, 21, 25, 26] steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + if: ${{ needs.generated-libraries-filter.outputs.units == 'true' }} with: persist-credentials: false - uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1 + if: ${{ needs.generated-libraries-filter.outputs.units == 'true' }} with: distribution: temurin java-version: ${{matrix.java}} cache: maven - run: java -version + if: ${{ needs.generated-libraries-filter.outputs.units == 'true' }} - run: .kokoro/build.sh - if: ${{ needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.units == 'true' }} env: JOB_TYPE: test JOB_NAME: units-${{matrix.java}} @@ -85,6 +88,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 90 needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.units == 'true' }} name: "units (8)" steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 @@ -110,7 +114,6 @@ jobs: distribution: temurin cache: maven - run: .kokoro/build.sh - if: ${{ needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true' }} shell: bash env: JOB_TYPE: test