diff --git a/.github/workflows/caching-envs-example.yml b/.github/workflows/caching-envs-example.yml index 200bd5c6..bb1d842d 100644 --- a/.github/workflows/caching-envs-example.yml +++ b/.github/workflows/caching-envs-example.yml @@ -20,21 +20,6 @@ jobs: (github.event_name == 'schedule' && github.repository == 'conda-incubator/setup-miniconda') || (github.event_name != 'schedule') - strategy: - matrix: - include: - - os: ubuntu-latest - label: linux-64 - prefix: /usr/share/miniconda3/envs/anaconda-client-env - - - os: macos-latest - label: osx-64 - prefix: /Users/runner/miniconda3/envs/anaconda-client-env - - - os: windows-latest - label: win-64 - prefix: C:\Miniconda3\envs\anaconda-client-env - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -46,15 +31,17 @@ jobs: miniforge-version: latest activate-environment: anaconda-client-env use-mamba: true + + - name: Get Date + id: get-date + run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" + shell: bash - - name: Set cache date - run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV - - - name: Cache conda env + - name: Cache Conda env uses: actions/cache@v2 with: - path: ${{ matrix.prefix }} - key: ${{ matrix.label }}-conda-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} + path: ${{ env.CONDA }}/envs + key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.CACHE_NUMBER }} env: # Increase this value to reset cache if etc/example-environment.yml has not changed CACHE_NUMBER: 0 diff --git a/.github/workflows/example-5.yml b/.github/workflows/example-5.yml index b5ccd5de..343518a5 100644 --- a/.github/workflows/example-5.yml +++ b/.github/workflows/example-5.yml @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v2 - uses: ./ with: - installer-url: https://github.com/conda-forge/miniforge/releases/download/4.9.0-3/Miniforge-pypy3-4.9.0-3-MacOSX-x86_64.sh?foo=bar&baz + installer-url: https://github.com/conda-forge/miniforge/releases/download/4.11.0-0/Miniforge-pypy3-4.11.0-0-MacOSX-x86_64.sh?foo=bar&baz allow-softlinks: true show-channel-urls: true use-only-tar-bz2: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0f3eee9d..72894d9d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,5 +26,5 @@ jobs: - uses: actions/checkout@v2 - run: | npm install - npm check - npm build + npm run check + npm run build diff --git a/README.md b/README.md index a7170daf..b0639cf0 100644 --- a/README.md +++ b/README.md @@ -575,31 +575,7 @@ as they are not included in the conda package cache. ### Caching environments -A Miniforge variant is recommended to cache deployed environments, since the -Miniconda installation path requires succesive changes of folder ownership in -order to work with the `cache` action. - -Every operating system use a different Miniforge `prefix`, so if you want to -cache the environment on all of them you must use a `matrix` strategy. - -```yaml - strategy: - matrix: - include: - - os: ubuntu-latest - label: linux-64 - prefix: /usr/share/miniconda3/envs/anaconda-client-env - - - os: macos-latest - label: osx-64 - prefix: /Users/runner/miniconda3/envs/anaconda-client-env - - - os: windows-latest - label: win-64 - prefix: C:\Miniconda3\envs\anaconda-client-env -``` - -Then, the first installation step should setup a Miniconda variant without +The first installation step should setup a Miniconda variant without specifying a environment file. ```yaml @@ -613,18 +589,22 @@ specifying a environment file. ``` It's a good idea to refresh the cache every 24 hours to avoid inconsistencies -of package versions between the CI pipeline and local installations. You can -skip that step if you use a resolved environment file product of +of package versions between the CI pipeline and local installations. +Here we ensure that this happens by adding the current date to the cache key. +You can remove the "Get Date" step below if you use a resolved environment file product of `conda env export` or `conda list --explicit`. ```yaml - - name: Set cache date - run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV - - - uses: actions/cache@v2 + - name: Get Date + id: get-date + run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" + shell: bash + + - name: Cache Conda env + uses: actions/cache@v2 with: - path: ${{ matrix.prefix }} - key: ${{ matrix.label }}-conda-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} + path: ${{ env.CONDA }}/envs + key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.CACHE_NUMBER }} env: # Increase this value to reset cache if etc/example-environment.yml has not changed CACHE_NUMBER: 0