diff --git a/.github/actions/configure-environment/action.yml b/.github/actions/configure-environment/action.yml index 4c505a8a..012803e7 100644 --- a/.github/actions/configure-environment/action.yml +++ b/.github/actions/configure-environment/action.yml @@ -13,18 +13,35 @@ runs: /#.*arch=/ && $0 ~ "arch="arch { print } ' environment.yml > ci-environment.yml - - uses: actions/cache@v2 + - name: Setup Mambaforge + uses: conda-incubator/setup-miniconda@v2 with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ hashFiles('ci-environment.yml') }} - restore-keys: | - ${{ runner.os }}-conda- + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: yardl + # environment-file: ci-environment.yml + use-mamba: true + + - name: Get Date + id: get-date + shell: bash + run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" - - uses: conda-incubator/setup-miniconda@v2 + - name: Cache Conda Env + uses: actions/cache@v2 with: - activate-environment: yardl - environment-file: ci-environment.yml - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + path: ${{ env.CONDA }}/envs + key: + conda-${{ runner.os }}--${{ runner.arch }}--${{ + steps.get-date.outputs.today }}-${{ + hashFiles('ci-environment.yml') }}-${{ + env.CONDA_CACHE_NUMBER }} + # key: ${{ runner.os }}-conda-${{ hashFiles('ci-environment.yml') }} + id: cache + + - name: Update Environment + run: mamba env update -n yardl -f ci-environment.yml + if: steps.cache.outputs.cache-hit != 'true' - uses: actions/setup-go@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cbee35d..82227a86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,10 @@ defaults: # See https://github.com/marketplace/actions/setup-miniconda#important shell: bash -el {0} +env: + # Increase this to reset cache manually + CONDA_CACHE_NUMBER: 0 + jobs: validate: strategy: @@ -39,7 +43,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: "1.21.3" cache-dependency-path: tooling/go.sum @@ -137,7 +141,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: "1.21.3" cache-dependency-path: tooling/go.sum