Skip to content

ci: use spawn for multiprocessing in nbdev_test #1784

ci: use spawn for multiprocessing in nbdev_test

ci: use spawn for multiprocessing in nbdev_test #1784

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NIXTLA_NUMBA_CACHE: "1"
jobs:
run-tests:
name: Run tests for cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
runs-on: ${{ matrix.os-platform[0] }}
timeout-minutes: 60
env:
CIBW_BUILD_FRONTEND: build[uv]
CIBW_ENVIRONMENT: NIXTLA_NUMBA_CACHE=1
strategy:
fail-fast: false
matrix:
python-version: [39, 310, 311, 312]
os-platform:
[
[ubuntu-latest, manylinux_x86_64],
[ubuntu-latest, manylinux_aarch64],
[windows-latest, win_amd64],
[macos-13, macosx_x86_64],
[macos-14, macosx_arm64],
]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: "true"
- name: Set up QEMU
if: matrix.os-platform[1] == 'manylinux_aarch64'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64
- name: Set up uv
uses: astral-sh/setup-uv@e779db74266a80753577425b0f4ee823649f251d # v3.2.3
with:
version: "latest"
- name: Build wheels and run all tests
if: matrix.os-platform[0] == 'ubuntu-latest'
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
env:
CIBW_BUILD: cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
CIBW_TEST_SKIP: "*linux_aarch64"
CIBW_BEFORE_TEST: yum install -y java
CIBW_TEST_COMMAND: >
uv pip install -r {project}/setup.py --extra all &&
nbdev_test --path {project}/nbs/ --skip_file_re "(distributed|prophet).*.ipynb" --pause 1.0 --do_print --timing &&
pytest --durations=0 {project}/action_files -k "not efficiency"
- name: Build wheels and run local tests
if: matrix.os-platform[0] != 'ubuntu-latest'
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
env:
CIBW_BUILD: cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
CIBW_TEST_COMMAND: >
uv pip install -r {project}/setup.py --extra dev --extra plotly &&
python {project}/action_files/nbdev_test --path {project}/nbs/ --skip_file_re "(distributed|prophet).*.ipynb" --pause 1.0 --do_print --timing
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: github.event_name == 'push'
with:
name: artifact-cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
path: wheelhouse/*.whl
retention-days: 1
publish-nightly-wheels:
if: github.event_name == 'push'
needs: [run-tests]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_NIXTLA_PACKAGES }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_NIXTLA_PACKAGES }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download wheels
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
pattern: "artifact-*"
merge-multiple: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.10"
- name: Publish wheels
run: |
pip install awscli beautifulsoup4
aws s3 cp s3://nixtla-packages/statsforecast/index.html .
python action_files/update_index.py
aws s3 sync dist s3://nixtla-packages/statsforecast/
test-m3-performance:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: "true"
- name: Set up environment
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.10"
- name: Install the library
run: pip install uv && uv pip install --system ".[dev]"
- name: Run M3 experiment
run: |
python -m src.experiment
python -m src.evaluation --test
working-directory: ./experiments/m3
efficiency-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: "true"
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Install dependencies
run: pip install uv && uv pip install --system . pytest-codspeed pytest-xdist
- name: Run benchmarks
uses: CodSpeedHQ/action@fa1dcde8d58f2ab0b407a6a24d6cc5a8c1444a8c # 3.1.0
with:
token: ${{ secrets.CODESPEED_TOKEN }}
run: pytest action_files/test_efficiency.py --codspeed -n 2