Skip to content

Commit 5cb00c5

Browse files
committed
feat: adapt CI and tests for py3.7-3.12 and torch2.4/2.5
1 parent f685425 commit 5cb00c5

8 files changed

Lines changed: 371 additions & 176 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,74 @@
11
name: CI
22

3-
on:
3+
on:
44
push:
5-
path:
6-
- 'deepctr_torch/*'
7-
- 'tests/*'
5+
paths:
6+
- "deepctr_torch/**"
7+
- "tests/**"
8+
- "setup.py"
9+
- ".github/workflows/**"
810
pull_request:
9-
path:
10-
- 'deepctr_torch/*'
11-
- 'tests/*'
12-
11+
paths:
12+
- "deepctr_torch/**"
13+
- "tests/**"
14+
- "setup.py"
15+
- ".github/workflows/**"
16+
workflow_dispatch:
17+
1318
jobs:
1419
build:
15-
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 120
20+
runs-on: ubuntu-22.04
21+
timeout-minutes: 180
1822
strategy:
23+
fail-fast: false
1924
matrix:
20-
python-version: [3.6,3.7,3.8,3.9,3.10.7]
21-
torch-version: [1.2.0,1.3.0,1.4.0,1.5.0,1.6.0,1.7.1,1.8.1,1.9.0,1.10.2,1.11.0,1.12.1]
22-
23-
exclude:
24-
- python-version: 3.6
25-
torch-version: 1.11.0
26-
- python-version: 3.6
27-
torch-version: 1.12.1
28-
- python-version: 3.8
29-
torch-version: 1.2.0
30-
- python-version: 3.8
31-
torch-version: 1.3.0
32-
- python-version: 3.9
33-
torch-version: 1.2.0
34-
- python-version: 3.9
35-
torch-version: 1.3.0
36-
- python-version: 3.9
37-
torch-version: 1.4.0
38-
- python-version: 3.9
39-
torch-version: 1.5.0
40-
- python-version: 3.9
41-
torch-version: 1.6.0
42-
- python-version: 3.9
43-
torch-version: 1.7.1
44-
- python-version: 3.10.7
45-
torch-version: 1.2.0
46-
- python-version: 3.10.7
47-
torch-version: 1.3.0
48-
- python-version: 3.10.7
49-
torch-version: 1.4.0
50-
- python-version: 3.10.7
51-
torch-version: 1.5.0
52-
- python-version: 3.10.7
53-
torch-version: 1.6.0
54-
- python-version: 3.10.7
55-
torch-version: 1.7.1
56-
- python-version: 3.10.7
57-
torch-version: 1.8.1
58-
- python-version: 3.10.7
59-
torch-version: 1.9.0
60-
- python-version: 3.10.7
61-
torch-version: 1.10.2
25+
include:
26+
# Python 3.7 cannot install torch 2.4/2.5 wheels from official index.
27+
# Keep a legacy torch smoke job to guarantee 3.7 runtime compatibility.
28+
- python-version: "3.7"
29+
torch-version: "1.13.1"
30+
- python-version: "3.8"
31+
torch-version: "2.4.1"
32+
- python-version: "3.9"
33+
torch-version: "2.4.1"
34+
- python-version: "3.9"
35+
torch-version: "2.5.1"
36+
- python-version: "3.10"
37+
torch-version: "2.4.1"
38+
- python-version: "3.10"
39+
torch-version: "2.5.1"
40+
- python-version: "3.11"
41+
torch-version: "2.4.1"
42+
- python-version: "3.11"
43+
torch-version: "2.5.1"
44+
- python-version: "3.12"
45+
torch-version: "2.4.1"
46+
- python-version: "3.12"
47+
torch-version: "2.5.1"
48+
49+
env:
50+
TORCH_VERSION: ${{ matrix.torch-version }}
51+
TORCH_INDEX_URL: https://download.pytorch.org/whl/cpu
52+
6253
steps:
63-
64-
- uses: actions/checkout@v3
65-
66-
- name: Setup python environment
67-
uses: actions/setup-python@v4
68-
with:
69-
python-version: ${{ matrix.python-version }}
54+
- uses: actions/checkout@v5
55+
56+
- name: Setup python environment
57+
uses: actions/setup-python@v6
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Install dependencies
62+
run: bash tests/ci/install.sh
63+
64+
- name: Test with pytest
65+
timeout-minutes: 180
66+
run: bash tests/ci/test.sh
7067

71-
- name: Install dependencies
72-
run: |
73-
pip3 install -q torch==${{ matrix.torch-version }}
74-
pip install -q requests
75-
pip install -e .
76-
- name: Test with pytest
77-
timeout-minutes: 120
78-
run: |
79-
pip install -q pytest
80-
pip install -q pytest-cov
81-
pip install -q python-coveralls
82-
pip install -q sklearn
83-
pytest --cov=deepctr_torch --cov-report=xml
84-
- name: Upload coverage to Codecov
85-
uses: codecov/codecov-action@v3.1.0
86-
with:
87-
token: ${{secrets.CODECOV_TOKEN}}
88-
file: ./coverage.xml
89-
flags: pytest
90-
name: py${{ matrix.python-version }}-torch${{ matrix.torch-version }}
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v6
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}
72+
files: ./coverage.xml
73+
flags: pytest
74+
name: py${{ matrix.python-version }}-torch${{ matrix.torch-version }}

0 commit comments

Comments
 (0)