Fix saving cache taking too long #519
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test caching | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
merge_group: | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
test-download1: | |
name: Test download cache 1/2 | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-downloads-key: download-key-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-download2: | |
name: Test download cache 2/2 | |
timeout-minutes: 10 | |
needs: test-download1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-downloads-key: download-key-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env1: | |
name: Test env cache 1/2 | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-environment-key: env-key-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env2: | |
name: Test env cache 2/2 | |
timeout-minutes: 10 | |
needs: test-env1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-environment-key: env-key-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env-changing-root-path1: | |
name: Test env cache with changing root path 1/2 | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-environment-key: env-root-path-key-${{ github.sha }}-${{ github.run_attempt }} | |
micromamba-root-path: ~/micromamba | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env-changing-root-path2: | |
name: Test env cache with changing root path 2/2 | |
timeout-minutes: 10 | |
needs: test-env-changing-root-path1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-environment-key: env-root-path-key-${{ github.sha }}-${{ github.run_attempt }} | |
micromamba-root-path: ~/micromamba2 | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env-then-download1: | |
name: Test env then download 1/2 | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
environment-file: test/environment.yml | |
cache-environment-key: env-then-download-env-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test-env-then-download2: | |
name: Test env then download 2/2 | |
timeout-minutes: 10 | |
needs: test-env-then-download1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
# Since the environment is cached, there will be no downloaded packages in $MAMBA_ROOT_PREFIX/pkgs. | |
# The caching should not fail because of this. | |
environment-file: test/environment.yml | |
cache-environment-key: env-then-download-env-${{ github.sha }}-${{ github.run_attempt }} | |
cache-downloads-key: env-then-download-download-${{ github.sha }}-${{ github.run_attempt }} | |
- name: test environment name | |
run: | | |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'" | |
test -d $MAMBA_ROOT_PREFIX | |
! test -d $MAMBA_ROOT_PREFIX/pkgs |