Skip to content

Commit 1486ce6

Browse files
committed
Refactor workflows
1 parent c36911c commit 1486ce6

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

.github/changes-filter.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wireshark:
2+
- 'wireshark/**'
3+
- 'proto/PulsarApi.proto'

.github/workflows/ci-pr-validation.yaml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,33 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31+
changed_files_job:
32+
name: Preconditions
33+
runs-on: ubuntu-20.04
34+
outputs:
35+
wireshark_only: ${{ steps.check_changes.outputs.wireshark_only }}
36+
steps:
37+
- name: checkout
38+
uses: actions/checkout@v3
39+
40+
- name: Detect changed files
41+
id: changes
42+
uses: apache/pulsar-test-infra/paths-filter@master
43+
with:
44+
filters: .github/changes-filter.yaml
45+
list-files: csv
46+
47+
- name: Check changed files
48+
id: check_changes
49+
run: |
50+
echo "::set-output name=wireshark_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.wireshark_count) && fromJSON(steps.changes.outputs.wireshark_count) > 0 }}"
3151
3252
wireshark-dissector-build:
3353
name: Build the Wireshark dissector
3454
runs-on: ubuntu-20.04
3555
timeout-minutes: 60
56+
needs: changed_files_job
57+
if: ${{ needs.changed_files_job.outputs.wireshark_only == 'true' }}
3658

3759
steps:
3860
- name: checkout
@@ -52,6 +74,8 @@ jobs:
5274
name: Run unit tests
5375
runs-on: ubuntu-22.04
5476
timeout-minutes: 120
77+
needs: changed_files_job
78+
if: ${{ needs.changed_files_job.outputs.wireshark_only != 'true' }}
5579

5680
steps:
5781
- name: checkout
@@ -97,8 +121,9 @@ jobs:
97121
cpp-build-windows:
98122
timeout-minutes: 120
99123
name: Build CPP Client on ${{ matrix.name }}
100-
needs: unit-tests
101124
runs-on: ${{ matrix.os }}
125+
needs: ['unit-tests', 'changed_files_job']
126+
if: ${{ needs.changed_files_job.outputs.wireshark_only != 'true' }}
102127
env:
103128
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
104129
INSTALL_DIR: 'C:\\pulsar-cpp'
@@ -214,8 +239,9 @@ jobs:
214239
package:
215240
name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
216241
runs-on: ubuntu-22.04
217-
needs: unit-tests
218242
timeout-minutes: 500
243+
needs: ['unit-tests', 'changed_files_job']
244+
if: ${{ needs.changed_files_job.outputs.wireshark_only != 'true' }}
219245

220246
strategy:
221247
fail-fast: true
@@ -258,7 +284,8 @@ jobs:
258284
timeout-minutes: 120
259285
name: Build CPP Client on macOS
260286
runs-on: macos-12
261-
needs: unit-tests
287+
needs: ['unit-tests', 'changed_files_job']
288+
if: ${{ needs.changed_files_job.outputs.wireshark_only != 'true' }}
262289
steps:
263290
- name: checkout
264291
uses: actions/checkout@v3

0 commit comments

Comments
 (0)