Skip to content

test: add reusable correctness contracts #92

test: add reusable correctness contracts

test: add reusable correctness contracts #92

Workflow file for this run

name: CI_TF2
on:
push:
paths:
- 'deepctr/**'
- 'tests/**'
- 'setup.py'
- 'setup.cfg'
- '.github/workflows/**'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-22.04
outputs:
code_related: ${{ steps.filter.outputs.code_related }}
steps:
- uses: actions/checkout@v5
- name: Detect code-related changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
code_related:
- 'deepctr/**'
- 'tests/**'
- 'setup.py'
- 'setup.cfg'
- '.github/workflows/**'
build:
needs: changes
runs-on: ubuntu-22.04
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.10"
tf-version: "2.10.0"
use-legacy-keras: "0"
- python-version: "3.10"
tf-version: "2.15.0"
use-legacy-keras: "0"
- python-version: "3.11"
tf-version: "2.15.0"
use-legacy-keras: "0"
- python-version: "3.10"
tf-version: "2.20.0"
use-legacy-keras: "1"
- python-version: "3.11"
tf-version: "2.20.0"
use-legacy-keras: "1"
- python-version: "3.12"
tf-version: "2.20.0"
use-legacy-keras: "1"
env:
TF_USE_LEGACY_KERAS: ${{ matrix.use-legacy-keras }}
steps:
- name: Docs-only PR fast-path
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.code_related != 'true' }}
run: echo "Docs-only PR detected; skipping heavy CI steps."
- uses: actions/checkout@v5
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
- name: Setup python environment
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
run: |
python -m pip install -q --upgrade pip setuptools wheel
python -m pip install -q "numpy<2"
python -m pip install -q tensorflow==${{ matrix.tf-version }}
if [ "${{ matrix.use-legacy-keras }}" = "1" ]; then
python -m pip install -q tf-keras==${{ matrix.tf-version }}
fi
python -m pip install -q pytest pytest-cov
python -m pip install -e .
python -m pip check
- name: Test with pytest
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
timeout-minutes: 180
run: |
pytest --cov=deepctr --cov-report=xml --cov-report=term-missing:skip-covered
- name: Upload coverage to Codecov
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.code_related == 'true' }}
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: pytest
name: py${{ matrix.python-version }}-tf${{ matrix.tf-version }}