Skip to content

Commit

Permalink
[improve][ci] Skip other tests when there are only cpp/python related…
Browse files Browse the repository at this point in the history
… changes (apache#16988)
  • Loading branch information
RobertIndie authored Aug 11, 2022
1 parent 96930fd commit 5cdb591
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .github/changes-filter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ docs:
- '**/*.md'
tests:
- added|modified: '**/src/test/java/**/*.java'
cpp:
- 'pulsar-client-cpp/**'
12 changes: 7 additions & 5 deletions .github/workflows/ci-go-functions-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,33 @@ jobs:

- name: Check changed files
id: check_changes
run: echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
run: |
echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
echo "::set-output name=cpp_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.cpp_count) && fromJSON(steps.changes.outputs.cpp_count) > 0 }}"
- name: Set up Go
uses: actions/setup-go@v2
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
with:
go-version: ${{ matrix.go-version }}
id: go

- name: InstallTool
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
run: |
cd pulsar-function-go
wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.18.0
./bin/golangci-lint --version
- name: Build
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
run: |
cd pulsar-function-go
export GO111MODULE=on
go build ./...
- name: CheckStyle
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
run: |
cd pulsar-function-go
export GO111MODULE=on
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci-go-functions-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ jobs:

- name: Check changed files
id: check_changes
run: echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
run: |
echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
echo "::set-output name=cpp_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.cpp_count) && fromJSON(steps.changes.outputs.cpp_count) > 0 }}"
- name: Set up Go
uses: actions/setup-go@v2
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Run tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
if: ${{ steps.check_changes.outputs.docs_only != 'true' && steps.check_changes.outputs.cpp_only != 'true' }}
run: |
cd pulsar-function-go
export GO111MODULE=on
Expand Down
85 changes: 44 additions & 41 deletions .github/workflows/pulsar-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
docs_only: ${{ steps.check_changes.outputs.docs_only }}
cpp_only: ${{ steps.check_changes.outputs.cpp_only }}
changed_tests: ${{ steps.changes.outputs.tests_files }}
steps:
- name: checkout
Expand All @@ -57,7 +58,9 @@ jobs:

- name: Check changed files
id: check_changes
run: echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
run: |
echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
echo "::set-output name=cpp_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.cpp_count) && fromJSON(steps.changes.outputs.cpp_count) > 0 }}"
build-and-license-check:
needs: changed_files_job
Expand Down Expand Up @@ -164,22 +167,22 @@ jobs:

steps:
- name: checkout
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/checkout@v2

- name: Tune Runner VM
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/tune-runner-vm

- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/ssh-access
with:
limit-access-to-actor: true

- name: Cache Maven dependencies
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/cache@v2
with:
path: |
Expand All @@ -191,28 +194,28 @@ jobs:
- name: Set up JDK ${{ matrix.jdk || '17' }}
uses: actions/setup-java@v2
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}

- name: Install gh-actions-artifact-client.js
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master

- name: Restore maven build results from Github artifact cache
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
- name: Run setup commands
if: ${{ matrix.setup && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ matrix.setup && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
${{ matrix.setup }}
- name: Run unit test group '${{ matrix.group }}'
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
CHANGED_TESTS="${{ needs.changed_files_job.outputs.tests_files }}" ./build/run_unit_group.sh ${{ matrix.group }}
Expand All @@ -221,34 +224,34 @@ jobs:
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps

- name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/copy-test-reports

- name: Report test summary as warning
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/merge-test-reports
with:
summary_title: 'Test Summary for Unit - ${{ matrix.name }}:'

- name: Publish the Test reports in Junit xml format
uses: actions/upload-artifact@v3
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
name: Unit-${{ matrix.group }}-test-report
path: test-reports
retention-days: 7

- name: Upload Surefire reports
uses: actions/upload-artifact@v3
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
name: Unit-${{ matrix.group }}-surefire-reports
path: surefire-reports
retention-days: 7

- name: Upload possible heap dump
uses: actions/upload-artifact@v3
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
name: Unit-${{ matrix.group }}-heapdump
path: /tmp/*.hprof
Expand All @@ -272,22 +275,22 @@ jobs:
UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/
steps:
- name: checkout
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/checkout@v2

- name: Tune Runner VM
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/tune-runner-vm

- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/ssh-access
with:
limit-access-to-actor: true

- name: Cache Maven dependencies
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/cache@v2
with:
path: |
Expand All @@ -299,31 +302,31 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v2
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
distribution: 'temurin'
java-version: 17

- name: Install gh-actions-artifact-client.js
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master

- name: restore maven build results from Github artifact cache
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
- name: Build java-test-image docker image
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
# build docker image
mvn -B -am -pl tests/docker-images/java-test-image install -Pcore-modules,-main,integrationTests,docker \
-Dmaven.test.skip=true -Ddockerfile.build.squash=true -DskipSourceReleaseAssembly=true \
-Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true
- name: save docker image apachepulsar/java-test-image:latest to Github artifact cache
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_save_image_to_github_actions_artifacts apachepulsar/java-test-image:latest pulsar-java-test-image
Expand Down Expand Up @@ -377,22 +380,22 @@ jobs:

steps:
- name: checkout
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/checkout@v2

- name: Tune Runner VM
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/tune-runner-vm

- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ github.repository != 'apache/pulsar' && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/ssh-access
with:
limit-access-to-actor: true

- name: Cache Maven dependencies
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: actions/cache@v2
with:
path: |
Expand All @@ -404,40 +407,40 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v2
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
distribution: 'temurin'
java-version: 17

- name: Install gh-actions-artifact-client.js
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master

- name: Restore maven build results from Github artifact cache
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
- name: Load docker image apachepulsar/java-test-image:latest from Github artifact cache
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_load_image_from_github_actions_artifacts pulsar-java-test-image
- name: Run setup commands
if: ${{ matrix.setup && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ matrix.setup && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
${{ matrix.setup }}
- name: Set up runtime JDK ${{ matrix.runtime_jdk }}
uses: actions/setup-java@v2
if: ${{ matrix.runtime_jdk && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ matrix.runtime_jdk && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
distribution: 'temurin'
java-version: ${{ matrix.runtime_jdk }}

- name: Run integration test group '${{ matrix.group }}'
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
run: |
./build/run_integration_group.sh ${{ matrix.group }}
Expand All @@ -446,34 +449,34 @@ jobs:
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps

- name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/copy-test-reports

- name: Report test summary as warning
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
uses: ./.github/actions/merge-test-reports
with:
summary_title: 'Test Summary for Integration - ${{ matrix.name }}:'

- name: Publish the Test reports in Junit xml format
uses: actions/upload-artifact@v3
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
name: Integration-${{ matrix.group }}-test-report
path: test-reports
retention-days: 7

- name: Upload Surefire reports
uses: actions/upload-artifact@v3
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
with:
name: Integration-${{ matrix.group }}-surefire-reports
path: surefire-reports
retention-days: 7

- name: Upload container logs
uses: actions/upload-artifact@v3
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
continue-on-error: true
with:
name: Integration-${{ matrix.group }}-container-logs
Expand All @@ -496,7 +499,7 @@ jobs:
'changed_files_job',
'integration-tests'
]
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down

0 comments on commit 5cdb591

Please sign in to comment.