Skip to content

Commit

Permalink
add update cache step whenever a branch is merged to master
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisbader committed Nov 3, 2024
1 parent 79807f1 commit 993b579
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 63 deletions.
1 change: 0 additions & 1 deletion .github/scripts/flavor_requirements.sh

This file was deleted.

61 changes: 29 additions & 32 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.9"
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: "3. Install Dev Dependencies"
- name: "Install Dev Dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
- name: "4. Lint"
- name: "Lint"
run: |
pre-commit run --all-files
Expand All @@ -36,40 +36,39 @@ jobs:
flavour: ['all']

steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python ${{ matrix.python-version }}"
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "3. Cache python environment"
- name: "Cache python environment"
uses: actions/cache@v4
id: pythonenv-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }}

- name: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "4. Install Dependencies"
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "5. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "6. Run tests"
- name: "Run tests"
run: |
pytest --durations=50 --cov=darts --cov-config=.coveragerc --cov-report=xml darts/tests
- name: "7. Codecov upload"
- name: "Codecov upload"
if: ${{ matrix.flavour == 'all' }}
uses: codecov/codecov-action@v4
with:
Expand All @@ -79,45 +78,44 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.9"
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'

# only restore cache but do not upload
- name: "3. Restore cached python environment"
- 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: "4. Install pandoc"
- name: "Install pandoc"
run: |
sudo apt-get install -y pandoc
- name: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "5. Install Dependencies"
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "6. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "7. Install Locally"
- name: "Install Locally"
run: |
pip install .
- name: "8. Build docs"
- name: "Build docs"
run: |
make --directory ./docs build-all-docs
Expand All @@ -127,41 +125,40 @@ jobs:
matrix:
example-name: [03-FFT-examples.ipynb, 04-RNN-examples.ipynb, 00-quickstart.ipynb, 02-data-processing.ipynb, 01-multi-time-series-and-covariates.ipynb]
steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.9"
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'

# only restore cache but do not upload
- name: "3. Restore cached python environment"
- 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: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "4. Install Dependencies"
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "5. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "6. Install Locally"
- name: "Install Locally"
run: |
pip install .
- name: "7. Run example ${{matrix.example-name}}"
- name: "Run example ${{matrix.example-name}}"
working-directory: ./examples
run: |
papermill ${{matrix.example-name}} ${{matrix.example-name}}
58 changes: 28 additions & 30 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.10"
- name: "Set up Python 3.10"
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: "3. Install Dev Dependencies"
- name: "Install Dev Dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
- name: "4. Lint"
- name: "Lint"
run: |
pre-commit run --all-files
Expand All @@ -35,19 +35,19 @@ jobs:
flavour: ['core', 'torch', 'all']

steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python ${{ matrix.python-version }}"
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "3. Setup pip"
- name: "Setup pip"
run: |
python -m pip install --upgrade pip
- name: "4. Install `flavor=${{ matrix.flavor }}` Dependencies"
- name: "Install `flavor=${{ matrix.flavor }}` Dependencies"
run: |
if [ "${{ matrix.flavor }}" == "core" ]; then
pip install -r requirements/core.txt -r requirements/dev.txt
Expand All @@ -57,18 +57,18 @@ jobs:
pip install -r requirements/dev-all.txt
fi
- name: "5. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "6. Run tests"
- name: "Run tests"
run: |
if [ "${{ matrix.flavor }}" == "all" ]; then
pytest --durations=50 --cov=darts --cov-config=.coveragerc --cov-report=xml darts/tests
else
pytest --durations=50
- name: "7. Codecov upload"
- name: "Codecov upload"
if: ${{ matrix.flavour == 'all' }}
uses: codecov/codecov-action@v4
with:
Expand All @@ -81,86 +81,84 @@ jobs:
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: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.9"
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'

# only restore cache but do not upload
- name: "3. Restore cached python environment"
- 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: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "4. Install Dependencies"
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "5. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "6. Install Locally"
- name: "Install Locally"
run: |
pip install .
- name: "7. Run example ${{matrix.example-name}}"
- name: "Run example ${{matrix.example-name}}"
working-directory: ./examples
run: |
papermill ${{matrix.example-name}} ${{matrix.example-name}}
docs:
runs-on: ubuntu-latest
steps:
- name: "1. Clone repository"
- name: "Clone repository"
uses: actions/checkout@v4

- name: "2. Set up Python 3.9"
- name: "Set up Python 3.9"
uses: actions/setup-python@v5
with:
python-version: '3.9'

# only restore cache but do not upload
- name: "3. Restore cached python environment"
- 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: "4. Install pandoc"
- name: "Install pandoc"
run: |
sudo apt-get install -y pandoc
- name: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
- name: "Setup Pip"
run: |
python -m pip install --upgrade pip
- name: "5. Install Dependencies"
- name: "Install Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "6. Install libomp (for LightGBM)"
- name: "Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "7. Install Locally"
- name: "Install Locally"
run: |
pip install .
- name: "8. Build docs"
- name: "Build docs"
run: |
make --directory ./docs build-all-docs
41 changes: 41 additions & 0 deletions .github/workflows/update-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: update-cache

on:
push:
branches:
- master

jobs:
# This workflow updates the python environment cache so that other workflows in different branches have access to it
build-cache:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-latest]
python-version: ['3.9']
flavour: ['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: "Cache python environment"
uses: actions/cache@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 Latest Dependencies"
run: |
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt

0 comments on commit 993b579

Please sign in to comment.