From df24b59782151b399c6498c9ed0cfba5b68d1d73 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 13:22:12 +0100 Subject: [PATCH 01/16] reduce tests to failing macos --- .github/workflows/develop.yml | 108 +--------------------------------- 1 file changed, 1 insertion(+), 107 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index d0320e21d8..e267249ae2 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -6,39 +6,11 @@ on: - master jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: "1. Clone repository" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "4. Lint" - run: | - ./gradlew lint - tests: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-13, ubuntu-latest] + os: [macos-13] python-version: ['3.9'] flavour: ['all'] @@ -68,10 +40,6 @@ jobs: run: | ./gradlew installPipLatest - - name: "5. Install libomp (for LightGBM)" - run: | - ./.github/scripts/libomp-${{ runner.os }}.sh - - name: "6. Attach cache for pip" uses: actions/cache@v1 id: cache @@ -89,77 +57,3 @@ jobs: with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} - - docs: - runs-on: ubuntu-latest - steps: - - name: "1. Clone repository" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - - name: "3. Install pandoc" - run: | - sudo apt-get install -y pandoc - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "4. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "4.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "5. Setup pip" - run: | - ./gradlew setupPip - - - name: "6. Attach cache for pip" - uses: actions/cache@v1 - id: cache - with: - path: ~/.cache/pip - key: tests-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} - - - name: "7. Build docs" - run: | - ./gradlew buildDocs - - check-examples: - runs-on: ubuntu-latest - strategy: - 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" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "4. Run examples ${{matrix.example-name}}" - run: | - ./gradlew checkExample -PexampleName=${{matrix.example-name}} From 7a0f8436de97c54b5857c3b75f3e258e7ec63a97 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 13:50:57 +0100 Subject: [PATCH 02/16] retry --- .github/workflows/develop.yml | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index e267249ae2..38c1015aea 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -23,37 +23,22 @@ jobs: with: python-version: ${{ matrix.python-version }} - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + - name: "3. Install dependencies" + run: | + python -m pip install --upgrade pip + pip install -r requirements/dev-all.txt - - name: "4. Setup pip" + - name: "4. Install libomp (for LightGBM)" run: | - ./gradlew installPipLatest + . /.github/scripts/libomp-${{ runner.os }}.sh - - name: "6. Attach cache for pip" + - name: "5. Attach cache for pip" uses: actions/cache@v1 id: cache with: path: ~/.cache/pip key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} - - name: "7. Tests" + - name: "6. Run tests" run: | - ./gradlew "test_${{matrix.flavour}}" - - - name: "8. Codecov upload" - if: ${{ matrix.flavour == 'all' }} - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} + pytest . From b70594a3ad3eeb4615a0b6b3502a7768556b0623 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 14:38:01 +0100 Subject: [PATCH 03/16] retry --- .github/workflows/develop.yml | 14 +-- .github/workflows/develop_old.yml | 165 ++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/develop_old.yml diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 38c1015aea..7ad80dfe86 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -16,10 +16,10 @@ jobs: steps: - name: "1. Clone repository" - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "2. Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -28,17 +28,13 @@ jobs: python -m pip install --upgrade pip pip install -r requirements/dev-all.txt - - name: "4. Install libomp (for LightGBM)" - run: | - . /.github/scripts/libomp-${{ runner.os }}.sh - - - name: "5. Attach cache for pip" - uses: actions/cache@v1 + - name: "4. Attach cache for pip" + uses: actions/cache@v4 id: cache with: path: ~/.cache/pip key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} - - name: "6. Run tests" + - name: "5. Run tests" run: | pytest . diff --git a/.github/workflows/develop_old.yml b/.github/workflows/develop_old.yml new file mode 100644 index 0000000000..d0320e21d8 --- /dev/null +++ b/.github/workflows/develop_old.yml @@ -0,0 +1,165 @@ +name: darts PR workflow + +on: + pull_request: + branches: + - master + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: "1. Clone repository" + uses: actions/checkout@v2 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + # downloading gradle multiple times in parallel can yield to connection errors + - name: "3. Cache gradle distribution" + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper/dists + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: "3.1 Cache gradle packages" + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + + - name: "4. Lint" + run: | + ./gradlew lint + + tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-13, ubuntu-latest] + python-version: ['3.9'] + flavour: ['all'] + + steps: + - name: "1. Clone repository" + uses: actions/checkout@v2 + + - name: "2. Set up Python ${{ matrix.python-version }}" + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + # downloading gradle multiple times in parallel can yield to connection errors + - name: "3. Cache gradle distribution" + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper/dists + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: "3.1 Cache gradle packages" + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + + - name: "4. Setup pip" + run: | + ./gradlew installPipLatest + + - name: "5. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh + + - name: "6. Attach cache for pip" + uses: actions/cache@v1 + id: cache + with: + path: ~/.cache/pip + key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} + + - name: "7. Tests" + run: | + ./gradlew "test_${{matrix.flavour}}" + + - name: "8. Codecov upload" + if: ${{ matrix.flavour == 'all' }} + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + + docs: + runs-on: ubuntu-latest + steps: + - name: "1. Clone repository" + uses: actions/checkout@v2 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + - name: "3. Install pandoc" + run: | + sudo apt-get install -y pandoc + + # downloading gradle multiple times in parallel can yield to connection errors + - name: "4. Cache gradle distribution" + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper/dists + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: "4.1 Cache gradle packages" + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + + - name: "5. Setup pip" + run: | + ./gradlew setupPip + + - name: "6. Attach cache for pip" + uses: actions/cache@v1 + id: cache + with: + path: ~/.cache/pip + key: tests-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + + - name: "7. Build docs" + run: | + ./gradlew buildDocs + + check-examples: + runs-on: ubuntu-latest + strategy: + 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" + uses: actions/checkout@v2 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + # downloading gradle multiple times in parallel can yield to connection errors + - name: "3. Cache gradle distribution" + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper/dists + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + - name: "3.1 Cache gradle packages" + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + + - name: "4. Run examples ${{matrix.example-name}}" + run: | + ./gradlew checkExample -PexampleName=${{matrix.example-name}} From cc66d1e48978d51d74c0020e9f318893d91751ba Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 14:53:18 +0100 Subject: [PATCH 04/16] retry --- .github/workflows/develop.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 7ad80dfe86..c77bd6e76b 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -28,13 +28,17 @@ jobs: python -m pip install --upgrade pip pip install -r requirements/dev-all.txt - - name: "4. Attach cache for pip" + - name: "4. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh + + - name: "5. Attach cache for pip" uses: actions/cache@v4 id: cache with: path: ~/.cache/pip key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} - - name: "5. Run tests" + - name: "6. Run tests" run: | pytest . From 000f480e753b5b0ecaa55a1e3ab940ac8f299625 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 15:19:14 +0100 Subject: [PATCH 05/16] add back cache file --- .github/scripts/flavor_requirements.sh | 1 + .github/workflows/develop.yml | 4 +- .github/workflows/develop_old.yml | 165 ------------------------- 3 files changed, 4 insertions(+), 166 deletions(-) create mode 100755 .github/scripts/flavor_requirements.sh delete mode 100644 .github/workflows/develop_old.yml diff --git a/.github/scripts/flavor_requirements.sh b/.github/scripts/flavor_requirements.sh new file mode 100755 index 0000000000..ca916d098d --- /dev/null +++ b/.github/scripts/flavor_requirements.sh @@ -0,0 +1 @@ +exit 0 diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index c77bd6e76b..939017b954 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -26,7 +26,9 @@ jobs: - name: "3. Install dependencies" run: | python -m pip install --upgrade pip - pip install -r requirements/dev-all.txt + pip install pip-tools + pip-compile requirements/core.txt requirements/notorch.txt requirements/torch.txt -o requirements-latest.txt + pip install -r requirements-latest.txt - name: "4. Install libomp (for LightGBM)" run: | diff --git a/.github/workflows/develop_old.yml b/.github/workflows/develop_old.yml deleted file mode 100644 index d0320e21d8..0000000000 --- a/.github/workflows/develop_old.yml +++ /dev/null @@ -1,165 +0,0 @@ -name: darts PR workflow - -on: - pull_request: - branches: - - master - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: "1. Clone repository" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "4. Lint" - run: | - ./gradlew lint - - tests: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-13, ubuntu-latest] - python-version: ['3.9'] - flavour: ['all'] - - steps: - - name: "1. Clone repository" - uses: actions/checkout@v2 - - - name: "2. Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "4. Setup pip" - run: | - ./gradlew installPipLatest - - - name: "5. Install libomp (for LightGBM)" - run: | - ./.github/scripts/libomp-${{ runner.os }}.sh - - - name: "6. Attach cache for pip" - uses: actions/cache@v1 - id: cache - with: - path: ~/.cache/pip - key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} - - - name: "7. Tests" - run: | - ./gradlew "test_${{matrix.flavour}}" - - - name: "8. Codecov upload" - if: ${{ matrix.flavour == 'all' }} - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - - docs: - runs-on: ubuntu-latest - steps: - - name: "1. Clone repository" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - - name: "3. Install pandoc" - run: | - sudo apt-get install -y pandoc - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "4. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "4.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "5. Setup pip" - run: | - ./gradlew setupPip - - - name: "6. Attach cache for pip" - uses: actions/cache@v1 - id: cache - with: - path: ~/.cache/pip - key: tests-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} - - - name: "7. Build docs" - run: | - ./gradlew buildDocs - - check-examples: - runs-on: ubuntu-latest - strategy: - 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" - uses: actions/checkout@v2 - - - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 - with: - python-version: '3.9' - - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} - - - name: "4. Run examples ${{matrix.example-name}}" - run: | - ./gradlew checkExample -PexampleName=${{matrix.example-name}} From b004399479f69e3144c9c5dd78530a7d35a62099 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 15:22:08 +0100 Subject: [PATCH 06/16] add comment --- .github/workflows/develop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 939017b954..06b1919c55 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -25,6 +25,7 @@ jobs: - name: "3. Install dependencies" run: | + # install pip and ALL requirements, and create requirements file for caching python -m pip install --upgrade pip pip install pip-tools pip-compile requirements/core.txt requirements/notorch.txt requirements/torch.txt -o requirements-latest.txt From ceb7232ff1831abb03c2a5d8fded2027e6d91189 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 16:13:57 +0100 Subject: [PATCH 07/16] try different caching --- .github/workflows/develop.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 06b1919c55..6dec97f88d 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -23,25 +23,28 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: "3. Install dependencies" + - name: "3. Cache virtualenv" + uses: actions/cache@v3 + id: virtualenv-cache + with: + path: .venv + key: ${{ matrix.os }}-${{ matrix.python-version }}-venv-${{ hashFiles('requirements/*.txt') }} + + - name: "3. Create virtualenv" + if: steps.virtualenv-cache.outputs.cache-hit != 'true' + run: | + python -m -venv .venv + + - name: "3. Install Dependencies" run: | - # install pip and ALL requirements, and create requirements file for caching - python -m pip install --upgrade pip - pip install pip-tools - pip-compile requirements/core.txt requirements/notorch.txt requirements/torch.txt -o requirements-latest.txt - pip install -r requirements-latest.txt + # activate and install ALL dependencies (potentially using cached files) + source .venv/bin/activate + python -m pip install -r requirements/dev-all.txt - name: "4. Install libomp (for LightGBM)" run: | ./.github/scripts/libomp-${{ runner.os }}.sh - - name: "5. Attach cache for pip" - uses: actions/cache@v4 - id: cache - with: - path: ~/.cache/pip - key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }} - - name: "6. Run tests" run: | pytest . From 79733a340646d7f421a5ebb365c18d74671cbe0e Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 16:19:17 +0100 Subject: [PATCH 08/16] fix bug --- .github/workflows/develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 6dec97f88d..6ec48c001b 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -33,7 +33,7 @@ jobs: - name: "3. Create virtualenv" if: steps.virtualenv-cache.outputs.cache-hit != 'true' run: | - python -m -venv .venv + python -m venv .venv - name: "3. Install Dependencies" run: | From 7a786740c8a21d2e9e36f1f9e2e431ef9826be1e Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 16:29:15 +0100 Subject: [PATCH 09/16] remove venv --- .github/workflows/develop.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 6ec48c001b..eafa8d8820 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -23,25 +23,24 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: "3. Cache virtualenv" + - name: "3. Cache python environment" uses: actions/cache@v3 id: virtualenv-cache with: - path: .venv - key: ${{ matrix.os }}-${{ matrix.python-version }}-venv-${{ hashFiles('requirements/*.txt') }} + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} - - name: "3. Create virtualenv" + - name: "3.1. (No-Cache) Setup Pip" if: steps.virtualenv-cache.outputs.cache-hit != 'true' run: | - python -m venv .venv + python -m pip install --upgrade pip - - name: "3. Install Dependencies" + - name: "4. Install Dependencies" run: | - # activate and install ALL dependencies (potentially using cached files) - source .venv/bin/activate - python -m pip install -r requirements/dev-all.txt + # install latest dependencies (potentially using cached files) + pip install -U -r requirements/dev-all.txt - - name: "4. Install libomp (for LightGBM)" + - name: "5. Install libomp (for LightGBM)" run: | ./.github/scripts/libomp-${{ runner.os }}.sh From 23bfaf5ab488aad57fd6d988752495e5e6a47ca3 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 17:11:34 +0100 Subject: [PATCH 10/16] add back codecov upload and ubuntu os --- .github/workflows/develop.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index eafa8d8820..8384c70485 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-13] + os: [macos-13, ubuntu-latest] python-version: ['3.9'] flavour: ['all'] @@ -24,11 +24,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: "3. Cache python environment" - uses: actions/cache@v3 + uses: actions/cache@v4 id: virtualenv-cache with: path: ${{ env.pythonLocation }} - key: ${{ matrix.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} - name: "3.1. (No-Cache) Setup Pip" if: steps.virtualenv-cache.outputs.cache-hit != 'true' @@ -47,3 +47,10 @@ jobs: - name: "6. Run tests" run: | pytest . + + - name: "7. Codecov upload" + if: ${{ matrix.flavour == 'all' }} + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From b0fb3e0d4ad0e003a6dd97882f31200fba88060c Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 18:03:52 +0100 Subject: [PATCH 11/16] add linting, docs, and example checks --- .github/workflows/develop.yml | 95 +++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 4 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 8384c70485..37b20512cd 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -6,6 +6,27 @@ on: - master jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: "1. Clone repository" + uses: actions/checkout@v4 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: "3. Install Dev Dependencies" + run: | + python -m pip install --upgrade pip + pip install -r requirements/dev.txt + + - name: "4. Lint" + run: | + pre-commit run --all-files + + tests: runs-on: ${{ matrix.os }} strategy: @@ -25,13 +46,13 @@ jobs: - name: "3. Cache python environment" uses: actions/cache@v4 - id: virtualenv-cache + id: pythonenv-cache with: path: ${{ env.pythonLocation }} key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} - - name: "3.1. (No-Cache) Setup Pip" - if: steps.virtualenv-cache.outputs.cache-hit != 'true' + - name: "(No-Cache) Setup Pip" + if: steps.pythonenv-cache.outputs.cache-hit != 'true' run: | python -m pip install --upgrade pip @@ -46,7 +67,7 @@ jobs: - name: "6. Run tests" run: | - pytest . + pytest --durations=50 --cov=darts --cov-config=.coveragerc --cov-report=xml darts/tests - name: "7. Codecov upload" if: ${{ matrix.flavour == 'all' }} @@ -54,3 +75,69 @@ jobs: with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + docs: + runs-on: ubuntu-latest + steps: + - name: "1. Clone repository" + uses: actions/checkout@v4 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: "3. Cache python environment" + uses: actions/cache@v4 + id: pythonenv-cache + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + + - name: "4. Install pandoc" + run: | + sudo apt-get install -y pandoc + + - name: "(No-Cache) Setup Pip" + if: steps.pythonenv-cache.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip + + - name: "4. Install Dependencies" + run: | + # install latest dependencies (potentially using cached files) + pip install -U -r requirements/dev-all.txt + + - name: "5. Install Locally" + run: | + pip install . + + - name: "6. Build docs" + run: | + make --directory ./docs build-all-docs + + check-examples: + runs-on: ubuntu-latest + strategy: + 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" + uses: actions/checkout@v4 + + - name: "2. Set up Python 3.9" + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: "3. Setup Pip" + run: | + python -m pip install --upgrade pip + + - name: "4. Install Locally" + run: | + pip install . + + - name: "5. Run example ${{matrix.example-name}}" + run: | + papermill ${{matrix.example-name}} ${{matrix.example-name}} From 1a698f04daa8e921cea49f4dc47ed6836e57821f Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 18:10:46 +0100 Subject: [PATCH 12/16] fix papermill missing --- .github/workflows/develop.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 37b20512cd..d117ac02ce 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -134,6 +134,10 @@ jobs: run: | python -m pip install --upgrade pip + - name: "4. Install Dependencies" + run: | + pip install -r requirements/dev-all.txt + - name: "4. Install Locally" run: | pip install . From 5f7db95fa227b20944ee2fa12b6909a384cba36c Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sat, 2 Nov 2024 18:19:33 +0100 Subject: [PATCH 13/16] change to exmaples workdir for example checks --- .github/workflows/develop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index d117ac02ce..bee29edfc2 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -143,5 +143,6 @@ jobs: pip install . - name: "5. Run example ${{matrix.example-name}}" + working-directory: ./examples run: | papermill ${{matrix.example-name}} ${{matrix.example-name}} From 1774468d2f3941d965164a56153592dd822d032f Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sun, 3 Nov 2024 11:30:56 +0100 Subject: [PATCH 14/16] improve caching, update merge workflow --- .github/workflows/develop.yml | 43 ++++++++--- .github/workflows/merge.yml | 134 ++++++++++++++++------------------ 2 files changed, 92 insertions(+), 85 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index bee29edfc2..cc951687c2 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -58,7 +58,7 @@ jobs: - name: "4. Install Dependencies" run: | - # install latest dependencies (potentially using cached files) + # install latest dependencies (potentially updating cached dependencies) pip install -U -r requirements/dev-all.txt - name: "5. Install libomp (for LightGBM)" @@ -87,12 +87,13 @@ jobs: with: python-version: '3.9' - - name: "3. Cache python environment" - uses: actions/cache@v4 + # only restore cache but do not upload + - name: "3. Restore cached python environment" + uses: actions/cache/restore@v4 id: pythonenv-cache with: path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} - name: "4. Install pandoc" run: | @@ -103,16 +104,20 @@ jobs: run: | python -m pip install --upgrade pip - - name: "4. Install Dependencies" + - name: "5. Install Dependencies" run: | - # install latest dependencies (potentially using cached files) + # install latest dependencies (potentially updating cached dependencies) pip install -U -r requirements/dev-all.txt - - name: "5. Install Locally" + - name: "6. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh + + - name: "7. Install Locally" run: | pip install . - - name: "6. Build docs" + - name: "8. Build docs" run: | make --directory ./docs build-all-docs @@ -130,19 +135,33 @@ jobs: with: python-version: '3.9' - - name: "3. Setup Pip" + # only restore cache but do not upload + - name: "3. 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' run: | python -m pip install --upgrade pip - name: "4. Install Dependencies" run: | - pip install -r requirements/dev-all.txt + # install latest dependencies (potentially updating cached dependencies) + pip install -U -r requirements/dev-all.txt + + - name: "5. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh - - name: "4. Install Locally" + - name: "6. Install Locally" run: | pip install . - - name: "5. Run example ${{matrix.example-name}}" + - name: "7. Run example ${{matrix.example-name}}" working-directory: ./examples run: | papermill ${{matrix.example-name}} ${{matrix.example-name}} diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 16e69f5798..6d0a9ba2d2 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -10,29 +10,21 @@ jobs: runs-on: ubuntu-latest steps: - name: "1. Clone repository" - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "2. Set up Python 3.10" - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: '3.10' - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + - name: "3. Install Dev Dependencies" + run: | + python -m pip install --upgrade pip + pip install -r requirements/dev.txt - name: "4. Lint" run: | - ./gradlew lint + pre-commit run --all-files tests: runs-on: ${{ matrix.os }} @@ -44,37 +36,37 @@ jobs: steps: - name: "1. Clone repository" - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "2. Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + - name: "3. Setup pip" + run: | + python -m pip install --upgrade pip - - name: "4. Setup pip" + - name: "4. Install `flavor=${{ matrix.flavor }}` Dependencies" run: | - ./gradlew setupPip + if [ "${{ matrix.flavor }}" == "core" ]; then + pip install -r requirements/core.txt -r requirements/dev.txt + elif [ "${{ matrix.flavor }}" == "torch" ]; then + pip install -r requirements/core.txt -r requirements/torch.txt -r requirements/dev.txt + elif [ "${{ matrix.flavor }}" == "all" ]; then + pip install -r requirements/dev-all.txt + fi - name: "5. Install libomp (for LightGBM)" run: | ./.github/scripts/libomp-${{ runner.os }}.sh - - name: "6. Tests" + - name: "6. Run tests" run: | - ./gradlew "test_${{matrix.flavour}}" + 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" if: ${{ matrix.flavour == 'all' }} @@ -90,71 +82,67 @@ jobs: 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" - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: '3.9' - # downloading gradle multiple times in parallel can yield to connection errors - - name: "3. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + - name: "3. Setup Pip" + run: | + python -m pip install --upgrade pip - - name: "3.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + - name: "4. Install Dependencies" + run: | + pip install -r requirements/dev-all.txt + + - name: "5. Install Locally" + run: | + pip install . # TODO: why is this a matrix? there is no pip caching, and we restart this for each item in the matrix - - name: "4. Run examples ${{matrix.example-name}}" + - name: "6. Run example ${{matrix.example-name}}" + working-directory: ./examples run: | - ./gradlew checkExample -PexampleName=${{matrix.example-name}} + papermill ${{matrix.example-name}} ${{matrix.example-name}} docs: runs-on: ubuntu-latest - steps: - name: "1. Clone repository" - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "2. Set up Python 3.9" - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: '3.9' - - name: "3. Install pandoc" + - name: "3. Cache python environment" + uses: actions/cache@v4 + id: pythonenv-cache + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + + - name: "4. Install pandoc" run: | sudo apt-get install -y pandoc - # downloading gradle multiple times in parallel can yield to connection errors - - name: "4. Cache gradle distribution" - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper/dists - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: "4.1 Cache gradle packages" - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }} + - name: "(No-Cache) Setup Pip" + if: steps.pythonenv-cache.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip - - name: "5. Setup pip" + - name: "5. Install Dependencies" run: | - ./gradlew setupPip + # install latest dependencies (potentially using cached files) + pip install -U -r requirements/dev-all.txt - - name: "6. Attach cache for pip" - uses: actions/cache@v1 - id: cache - with: - path: ~/.cache/pip - key: release-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + - name: "6. Install Locally" + run: | + pip install . - name: "7. Build docs" run: | - ./gradlew buildDocs + make --directory ./docs build-all-docs From 79807f128c38de74a24db8dfd9a433cd23c13adb Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sun, 3 Nov 2024 11:38:43 +0100 Subject: [PATCH 15/16] update merge workflow to use cache --- .github/workflows/merge.yml | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 6d0a9ba2d2..58db19465a 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -89,20 +89,33 @@ jobs: with: python-version: '3.9' - - name: "3. Setup Pip" + # only restore cache but do not upload + - name: "3. 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' run: | python -m pip install --upgrade pip - name: "4. Install Dependencies" run: | - pip install -r requirements/dev-all.txt + # install latest dependencies (potentially updating cached dependencies) + pip install -U -r requirements/dev-all.txt + + - name: "5. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh - - name: "5. Install Locally" + - name: "6. Install Locally" run: | pip install . - # TODO: why is this a matrix? there is no pip caching, and we restart this for each item in the matrix - - name: "6. Run example ${{matrix.example-name}}" + - name: "7. Run example ${{matrix.example-name}}" working-directory: ./examples run: | papermill ${{matrix.example-name}} ${{matrix.example-name}} @@ -118,12 +131,13 @@ jobs: with: python-version: '3.9' - - name: "3. Cache python environment" - uses: actions/cache@v4 + # only restore cache but do not upload + - name: "3. Restore cached python environment" + uses: actions/cache/restore@v4 id: pythonenv-cache with: path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }} - name: "4. Install pandoc" run: | @@ -136,13 +150,17 @@ jobs: - name: "5. Install Dependencies" run: | - # install latest dependencies (potentially using cached files) + # install latest dependencies (potentially updating cached dependencies) pip install -U -r requirements/dev-all.txt - - name: "6. Install Locally" + - name: "6. Install libomp (for LightGBM)" + run: | + ./.github/scripts/libomp-${{ runner.os }}.sh + + - name: "7. Install Locally" run: | pip install . - - name: "7. Build docs" + - name: "8. Build docs" run: | make --directory ./docs build-all-docs From 993b579267c444e650cc0f299df6ecae04c9a7d7 Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sun, 3 Nov 2024 12:05:31 +0100 Subject: [PATCH 16/16] add update cache step whenever a branch is merged to master --- .github/scripts/flavor_requirements.sh | 1 - .github/workflows/develop.yml | 61 ++++++++++++-------------- .github/workflows/merge.yml | 58 ++++++++++++------------ .github/workflows/update-cache.yml | 41 +++++++++++++++++ 4 files changed, 98 insertions(+), 63 deletions(-) delete mode 100755 .github/scripts/flavor_requirements.sh create mode 100644 .github/workflows/update-cache.yml diff --git a/.github/scripts/flavor_requirements.sh b/.github/scripts/flavor_requirements.sh deleted file mode 100755 index ca916d098d..0000000000 --- a/.github/scripts/flavor_requirements.sh +++ /dev/null @@ -1 +0,0 @@ -exit 0 diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index cc951687c2..834c1a1026 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -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 @@ -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: @@ -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 @@ -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}} diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 58db19465a..41cf87f7a7 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -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 @@ -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 @@ -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: @@ -81,41 +81,40 @@ 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}} @@ -123,44 +122,43 @@ 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 diff --git a/.github/workflows/update-cache.yml b/.github/workflows/update-cache.yml new file mode 100644 index 0000000000..e6cfa2cace --- /dev/null +++ b/.github/workflows/update-cache.yml @@ -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