Skip to content

Update CI/CD pipelines Part 1 (#2580) #1022

Update CI/CD pipelines Part 1 (#2580)

Update CI/CD pipelines Part 1 (#2580) #1022

Workflow file for this run

name: darts PR merge workflow
on:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "Clone repository"
uses: actions/checkout@v4
- name: "Set up Python 3.10"
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: "Install Dev Dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
- name: "Lint"
run: |
pre-commit run --all-files
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-latest]
python-version: ['3.8', '3.10']
flavour: ['core', 'torch', 'all']
steps:
- name: "Clone repository"
uses: actions/checkout@v4
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Setup pip"
run: |
python -m pip install --upgrade pip
- name: "Install Dependencies Flavour ${{ matrix.flavour }}"
run: |
if [ "${{ matrix.flavour }}" == "core" ]; then
pip install -r requirements/core.txt -r requirements/dev.txt
elif [ "${{ matrix.flavour }}" == "torch" ]; then
pip install -r requirements/core.txt -r requirements/torch.txt -r requirements/dev.txt
elif [ "${{ matrix.flavour }}" == "all" ]; then
pip install -r requirements/dev-all.txt
fi
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "Run tests"
run: |
if [ "${{ matrix.flavour }}" == "all" ]; then
pytest --durations=50 --cov=darts --cov-config=.coveragerc --cov-report=xml darts/tests
else
pytest --durations=50
fi
- name: "Codecov upload"
if: ${{ matrix.flavour == 'all' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
check-examples:
runs-on: ubuntu-latest
strategy:
matrix:
example-name: [00-quickstart.ipynb, 01-multi-time-series-and-covariates.ipynb, 02-data-processing.ipynb, 03-FFT-examples.ipynb, 04-RNN-examples.ipynb, 05-TCN-examples.ipynb, 06-Transformer-examples.ipynb, 07-NBEATS-examples.ipynb, 08-DeepAR-examples.ipynb, 09-DeepTCN-examples.ipynb, 10-Kalman-filter-examples.ipynb, 11-GP-filter-examples.ipynb, 12-Dynamic-Time-Warping-example.ipynb, 13-TFT-examples.ipynb, 15-static-covariates.ipynb, 16-hierarchical-reconciliation.ipynb, 18-TiDE-examples.ipynb, 19-EnsembleModel-examples.ipynb, 20-RegressionModel-examples.ipynb, 21-TSMixer-examples.ipynb, 22-anomaly-detection-examples.ipynb]
steps:
- name: "Clone repository"
uses: actions/checkout@v4
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'
# only restore cache but do not upload
- name: "Restore cached python environment"
uses: actions/cache/restore@v4
id: pythonenv-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }}
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "Install Locally"
run: |
pip install .
- name: "Run example ${{matrix.example-name}}"
working-directory: ./examples
run: |
papermill ${{matrix.example-name}} ${{matrix.example-name}}
docs:
runs-on: ubuntu-latest
steps:
- name: "Clone repository"
uses: actions/checkout@v4
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'
# only restore cache but do not upload
- name: "Restore cached python environment"
uses: actions/cache/restore@v4
id: pythonenv-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }}
- name: "Install pandoc"
run: |
sudo apt-get install -y pandoc
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "Install Locally"
run: |
pip install .
- name: "Build docs"
run: |
make --directory ./docs build-all-docs