Skip to content

Support fixed/user-defined scaling factors for stable model refreshes #3749

Support fixed/user-defined scaling factors for stable model refreshes

Support fixed/user-defined scaling factors for stable model refreshes #3749

Workflow file for this run

name: Test
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# The lower bound from the pyproject.toml file
OLDEST_PYMC_VERSION: "$(grep -E 'pymc *[>=]' pyproject.toml | sed -n 's/.*[>=]=\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*/\\1/p')"
# NOTE: .test_durations is managed manually (committed to repo)
# - pytest-split uses this file to balance test execution times
# - Update by running the "Generate Test Durations" workflow manually
# - Only needed every few weeks or after major test changes
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
should_test: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- ".github/workflows/test.yml"
- "pyproject.toml"
- "tests/**.py"
- "pymc_marketing/**"
test:
needs: changes
if: ${{ needs.changes.outputs.should_test == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
linker: [cvm, numba]
config: [ {python-version: "3.11", oldest-pymc: false}, {python-version: "3.13", oldest-pymc: true} ]
group: [1, 2, 3, 4, 5, 6]
env:
PYTENSOR_FLAGS: linker=${{ matrix.linker }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.config.python-version }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: pip install pymc==${{ env.OLDEST_PYMC_VERSION }}
- name: Install package and dependencies
run: |
sudo apt-get install graphviz graphviz-dev
pip install -e .[test]
pip list
- name: Check oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: python -c "import pymc; assert pymc.__version__ == '${{ env.OLDEST_PYMC_VERSION }}', pymc.__version__"
- name: Run tests
run: |
pytest --splits 6 \
--group ${{ matrix.group }} \
--splitting-algorithm least_duration \
--durations-path .test_durations
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: ${{ matrix.config.python-version }}
fail_ci_if_error: false
test_slow:
needs: changes
if: ${{ needs.changes.outputs.should_test == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
linker: [cvm, numba]
group: [1, 2] # Reduced from 3 to 2 groups for better balance
env:
PYTENSOR_FLAGS: linker=${{ matrix.linker }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install package and dependencies
run: |
sudo apt-get install graphviz graphviz-dev
pip install -e .[test]
pip list
- name: Run tests
run: |
pytest --only-slow \
--splits 2 \
--group ${{ matrix.group }} \
--splitting-algorithm least_duration \
--durations-path .test_durations
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: "test_slow"
fail_ci_if_error: false
all_tests:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [changes, test, test_slow]
steps:
- name: Check build matrix status
if: ${{ !contains(fromJSON('["success", "skipped"]'), needs.test.result) || !contains(fromJSON('["success", "skipped"]'), needs.test_slow.result) }}
run: exit 1