Skip to content

Commit

Permalink
Add download and environment caching (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag authored Feb 24, 2022
1 parent a2be56c commit 1876988
Show file tree
Hide file tree
Showing 23 changed files with 190,225 additions and 6,015 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist/* linguist-generated=true
dist/** linguist-generated=true
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and lint
on:
push:
branches:
- main
pull_request: null

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm install
npm run build
git diff --exit-code
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm install
npm run lint
9 changes: 9 additions & 0 deletions .github/workflows/lockfiles/conda-linux-64.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Generated by conda-lock.
# platform: linux-64
# input_hash: 998e5781b9db69d647b7a60df21f1d24d125dc81d1e32a2aada7aefb6bd7d477
@EXPLICIT
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
https://conda.anaconda.org/conda-forge/linux-64/libgomp-11.2.0-h1d223b6_12.tar.bz2#763c5ec8116d984b4a33342236d7da36
https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-1_gnu.tar.bz2#561e277319a41d4f24f5c05a9ef63c04
https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-11.2.0-h1d223b6_12.tar.bz2#d34efbb8d7d6312c816b4bb647b818b1
https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.2.11-h36c2ea0_1013.tar.bz2#dcddf696ff5dfcab567100d691678e18
5 changes: 5 additions & 0 deletions .github/workflows/lockfiles/conda-osx-64.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by conda-lock.
# platform: osx-64
# input_hash: d73572c6997a61acdd2cd69b693154ebe6d4a74fdf9a6fc0ea0f0be858dc326a
@EXPLICIT
https://conda.anaconda.org/conda-forge/osx-64/libzlib-1.2.11-h9173be1_1013.tar.bz2#a3a6a53beaa92c5cfe52ee3a198e78cc
8 changes: 8 additions & 0 deletions .github/workflows/lockfiles/conda-win-64.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by conda-lock.
# platform: win-64
# input_hash: d0dd90bb50512cf5f723c8fea07f6c42f234db358f3c3b262b8ababd219a13be
@EXPLICIT
https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.20348.0-h57928b3_0.tar.bz2#6d666b6ea8251231ff508062d1e41f9c
https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.29.30037-h902a5da_6.tar.bz2#33d07ebe91062743eabc9e53a60d18e1
https://conda.anaconda.org/conda-forge/win-64/vc-14.2-hb210afc_6.tar.bz2#c2aecbc9b00ba6f352e27d3d61fd31fb
https://conda.anaconda.org/conda-forge/win-64/libzlib-1.2.11-h8ffe710_1013.tar.bz2#b28dd2488b4e5f892c67071acc1d0a8c
15 changes: 11 additions & 4 deletions .github/workflows/options.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: options
name: Test options
on:
push:
branches:
Expand All @@ -7,16 +7,21 @@ on:

jobs:
test:
name: Test options
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
pytest: ["6.1", "6.2"]
name: option
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
environment-file: false

- name: install mamba
uses: ./
with:
Expand All @@ -29,17 +34,19 @@ jobs:
- name: run python in powershell
shell: powershell
run: |
where micromamba
micromamba info
python -VV
python -c "import numpy"
micromamba --help
if: runner.os == 'Windows'

- name: run python in bash
shell: bash -l {0}
run: |
which micromamba
micromamba info
python -VV
python -c "import numpy"
micromamba --help
if: runner.os != 'Windows'

- name: test environment name in powershell
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Basic tests
on:
push:
branches:
Expand All @@ -7,12 +7,12 @@ on:

jobs:
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
name: test
steps:
- uses: actions/checkout@v2

Expand All @@ -22,42 +22,47 @@ jobs:
- name: run python in powershell
shell: powershell
run: |
which micromamba
micromamba info
which python
python -VV
python -c "import numpy"
echo "MAMBA_EXE=$Env:MAMBA_EXE"
which micromamba
python test/test_path.py
if: runner.os == 'Windows'

- name: run python in cmd.exe
shell: cmd /C call {0}
run: |
where micromamba
micromamba info
which python
python -VV
python -c "import numpy"
micromamba --help
echo "MAMBA_EXE=%MAMBA_EXE%"
where micromamba
python test/test_path.py
if: runner.os == 'Windows'

- name: run python in bash
shell: bash -l {0}
run: |
which micromamba
micromamba info
which python
python -VV
python -c "import numpy"
micromamba --help
echo "MAMBA_EXE=$MAMBA_EXE"
which micromamba
python test/test_path.py
# - name: run python in zsh
# shell: zsh -l {0}
# run: |
# which micromamba
# micromamba info
# which python
# python -VV
# python -c "import numpy"
# micromamba --help
# micromamba activate test
# echo "MAMBA_EXE=$MAMBA_EXE"
# which micromamba
# python test/test_path.py
# if: runner.os == 'macOS'
# if: runner.os == 'macOS'
6 changes: 3 additions & 3 deletions .github/workflows/test_bash.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bash
name: Test bash
on:
push:
branches:
Expand All @@ -7,6 +7,7 @@ on:

jobs:
test:
name: Test bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -17,7 +18,6 @@ jobs:
run:
shell: bash -l {0}

name: bash
steps:
- uses: actions/checkout@v2

Expand All @@ -35,4 +35,4 @@ jobs:
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'myenv'"
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'myenv'"
112 changes: 112 additions & 0 deletions .github/workflows/test_caching.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Test caching

on:
push:
branches:
- main
pull_request: null

defaults:
run:
shell: bash -l {0}

jobs:
test_download1:
name: Test download cache 1/2
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
cache-downloads: true

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'testenv'"
test_download2:
name: Test download cache 2/2
needs: [test_download1]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
cache-downloads: true

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'testenv'"
test_env1:
name: Test env cache 1/3
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
cache-env: true

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'testenv'"
test_env2:
name: Test env cache 2/3
needs: [test_env1]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
cache-env: true

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'testenv'"
test_env3:
if: false # Doesn't work
name: Test env cache 3/3
needs: [test_env1]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
cache-env: true
cache-env-always-update: true

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'testenv'"
37 changes: 37 additions & 0 deletions .github/workflows/test_lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test lock files
on:
push:
branches:
- main
pull_request: null

jobs:
test:
name: Test lock files
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
lock-file: conda-win-64.lock
- os: ubuntu-latest
lock-file: conda-linux-64.lock
- os: macos-latest
lock-file: conda-osx-64.lock
os: [windows-latest, ubuntu-latest, macos-latest]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2

- name: install from lockfile
uses: ./
with:
environment-name: lock_test
environment-file: .github/workflows/lockfiles/${{ matrix.lock-file }}

- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'lock_test'"
Loading

0 comments on commit 1876988

Please sign in to comment.