From 691cc7167fc758203e4e1bf9897b730311c0c0c2 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 10:24:08 +0200 Subject: [PATCH 1/3] CI: use setup-micromamba action --- .github/workflows/ci.yaml | 55 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0cdfca18..86dfdacf8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,6 @@ on: - cron: "0 5 * * TUE" env: - CONDA_CACHE_NUMBER: 1 # Change this value to manually reset the environment cache DATA_CACHE_NUMBER: 2 jobs: @@ -27,22 +26,12 @@ jobs: strategy: fail-fast: false + max-parallel: 3 matrix: - include: - # Matrix required to handle caching with Mambaforge - - os: ubuntu-latest - label: ubuntu-latest - prefix: /usr/share/miniconda3/envs/pypsa-eur - - - os: macos-latest - label: macos-latest - prefix: /Users/runner/miniconda3/envs/pypsa-eur - - - os: windows-latest - label: windows-latest - prefix: C:\Miniconda3\envs\pypsa-eur - - name: ${{ matrix.label }} + os: + - ubuntu-latest + - macos-latest + - windows-latest runs-on: ${{ matrix.os }} @@ -60,24 +49,29 @@ jobs: - name: Add solver to environment run: | echo -e "- glpk\n- ipopt<3.13.3" >> envs/environment.yaml - if: ${{ matrix.label }} == 'windows-latest' + if: ${{ matrix.os }} == 'windows-latest' - name: Add solver to environment run: | echo -e "- glpk\n- ipopt" >> envs/environment.yaml - if: ${{ matrix.label }} != 'windows-latest' + if: ${{ matrix.os }} != 'windows-latest' - - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 + - name: Setup micromamba + uses: mamba-org/setup-micromamba@v1 with: - miniforge-variant: Mambaforge - miniforge-version: latest - activate-environment: pypsa-eur - use-mamba: true + micromamba-version: latest + environment-file: envs/environment.yaml + log-level: debug + init-shell: bash + cache-environment: false + cache-downloads: true + + - name: Print installed dependencies + run: | + micromamba list - name: Set cache dates run: | - echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV - name: Cache data and cutouts folders @@ -88,17 +82,6 @@ jobs: cutouts key: data-cutouts-${{ env.WEEK }}-${{ env.DATA_CACHE_NUMBER }} - - name: Create environment cache - uses: actions/cache@v3 - id: cache - with: - path: ${{ matrix.prefix }} - key: ${{ matrix.label }}-conda-${{ env.DATE }}-${{ env.CONDA_CACHE_NUMBER }} - - - name: Update environment due to outdated or unavailable cache - run: mamba env update -n pypsa-eur -f envs/environment.yaml - if: steps.cache.outputs.cache-hit != 'true' - - name: Test snakemake workflow run: | conda activate pypsa-eur From 854b3b773c5e56804214e3ce7e470459ebf46e55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Jul 2023 08:25:02 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86dfdacf8..701002f98 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: fail-fast: false max-parallel: 3 matrix: - os: + os: - ubuntu-latest - macos-latest - windows-latest From e0942d4544d411304f50cc9dc14c910e0c01ac77 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 23 Jul 2023 10:58:38 +0200 Subject: [PATCH 3/3] CI: enable environment cache --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86dfdacf8..2a14d4f2b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -63,13 +63,9 @@ jobs: environment-file: envs/environment.yaml log-level: debug init-shell: bash - cache-environment: false + cache-environment: true cache-downloads: true - - name: Print installed dependencies - run: | - micromamba list - - name: Set cache dates run: | echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV