Skip to content

Commit 1cfd859

Browse files
committed
ci: skip heavy tests for docs-only pull requests
1 parent e9e0641 commit 1cfd859

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,27 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
changes:
20+
runs-on: ubuntu-22.04
21+
outputs:
22+
code_related: ${{ steps.filter.outputs.code_related }}
23+
steps:
24+
- uses: actions/checkout@v5
25+
26+
- name: Detect code-related changes
27+
id: filter
28+
uses: dorny/paths-filter@v3
29+
with:
30+
filters: |
31+
code_related:
32+
- 'deepctr/**'
33+
- 'tests/**'
34+
- 'setup.py'
35+
- 'setup.cfg'
36+
- '.github/workflows/**'
37+
1938
build:
39+
needs: changes
2040
runs-on: ubuntu-22.04
2141
timeout-minutes: 240
2242
strategy:
@@ -27,14 +47,21 @@ jobs:
2747
tf-version: "1.15.5"
2848

2949
steps:
50+
- name: Docs-only PR fast-path
51+
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.code_related != 'true' }}
52+
run: echo "Docs-only PR detected; skipping heavy CI steps."
53+
3054
- uses: actions/checkout@v5
55+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
3156

3257
- name: Setup python environment
58+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
3359
uses: actions/setup-python@v6
3460
with:
3561
python-version: ${{ matrix.python-version }}
3662

3763
- name: Install dependencies
64+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
3865
run: |
3966
python -m pip install -q --upgrade pip setuptools wheel
4067
python -m pip install -q "numpy<2"
@@ -45,11 +72,13 @@ jobs:
4572
python -m pip check
4673
4774
- name: Test with pytest
75+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
4876
timeout-minutes: 240
4977
run: |
5078
pytest --cov=deepctr --cov-report=xml --cov-report=term-missing:skip-covered
5179
5280
- name: Upload coverage to Codecov
81+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
5382
uses: codecov/codecov-action@v6
5483
with:
5584
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ci2.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,27 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
changes:
20+
runs-on: ubuntu-22.04
21+
outputs:
22+
code_related: ${{ steps.filter.outputs.code_related }}
23+
steps:
24+
- uses: actions/checkout@v5
25+
26+
- name: Detect code-related changes
27+
id: filter
28+
uses: dorny/paths-filter@v3
29+
with:
30+
filters: |
31+
code_related:
32+
- 'deepctr/**'
33+
- 'tests/**'
34+
- 'setup.py'
35+
- 'setup.cfg'
36+
- '.github/workflows/**'
37+
1938
build:
39+
needs: changes
2040
runs-on: ubuntu-22.04
2141
timeout-minutes: 180
2242
strategy:
@@ -45,14 +65,21 @@ jobs:
4565
TF_USE_LEGACY_KERAS: ${{ matrix.use-legacy-keras }}
4666

4767
steps:
68+
- name: Docs-only PR fast-path
69+
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.code_related != 'true' }}
70+
run: echo "Docs-only PR detected; skipping heavy CI steps."
71+
4872
- uses: actions/checkout@v5
73+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
4974

5075
- name: Setup python environment
76+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
5177
uses: actions/setup-python@v6
5278
with:
5379
python-version: ${{ matrix.python-version }}
5480

5581
- name: Install dependencies
82+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
5683
run: |
5784
python -m pip install -q --upgrade pip setuptools wheel
5885
python -m pip install -q "numpy<2"
@@ -65,11 +92,13 @@ jobs:
6592
python -m pip check
6693
6794
- name: Test with pytest
95+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
6896
timeout-minutes: 180
6997
run: |
7098
pytest --cov=deepctr --cov-report=xml --cov-report=term-missing:skip-covered
7199
72100
- name: Upload coverage to Codecov
101+
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
73102
uses: codecov/codecov-action@v6
74103
with:
75104
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)