mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Merge pull request #16 from debanjum/cache-conda-env-setup-to-improve-cloud-build
Cache Conda Setup to Improve Cloud Build Time
This commit is contained in:
commit
29543d2dc3
1 changed files with 37 additions and 25 deletions
62
.github/workflows/build.yml
vendored
62
.github/workflows/build.yml
vendored
|
@ -10,38 +10,50 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Run Tests
|
strategy:
|
||||||
runs-on: ubuntu-latest
|
matrix:
|
||||||
defaults:
|
include:
|
||||||
run:
|
- os: ubuntu-latest
|
||||||
shell: bash -l {0}
|
label: linux-64
|
||||||
|
prefix: /usr/share/miniconda3/envs/test
|
||||||
|
|
||||||
|
name: ${{ matrix.label }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Environment dependencies
|
|
||||||
run: |
|
- name: Install Environment Dependencies
|
||||||
sudo apt-get -y install libimage-exiftool-perl
|
shell: bash -l {0}
|
||||||
- name: Cache conda
|
run: sudo apt-get -y install libimage-exiftool-perl
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
- name: Setup Mambaforge
|
||||||
# Increase this value to reset cache if environment.yml has not changed
|
uses: conda-incubator/setup-miniconda@v2
|
||||||
CACHE_NUMBER: 0
|
|
||||||
with:
|
|
||||||
path: ~/conda_pkgs_dir
|
|
||||||
key:
|
|
||||||
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
|
|
||||||
hashFiles('environment.yml') }}
|
|
||||||
- uses: conda-incubator/setup-miniconda@v2
|
|
||||||
with:
|
with:
|
||||||
|
miniforge-variant: Mambaforge
|
||||||
|
miniforge-version: latest
|
||||||
activate-environment: test
|
activate-environment: test
|
||||||
|
use-mamba: true
|
||||||
environment-file: environment.yml
|
environment-file: environment.yml
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
auto-activate-base: false
|
auto-activate-base: false
|
||||||
use-only-tar-bz2: true
|
use-only-tar-bz2: true
|
||||||
- name: Conda Info
|
|
||||||
run: |
|
- name: Set cache date
|
||||||
conda info
|
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||||
conda list
|
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ matrix.prefix }}
|
||||||
|
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
|
||||||
|
env:
|
||||||
|
# Increase this value to reset cache if environment.yml has not changed
|
||||||
|
CACHE_NUMBER: 0
|
||||||
|
id: cache
|
||||||
|
|
||||||
|
- name: Update environment
|
||||||
|
run: mamba env update -n test -f environment.yml
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
- name: Run Pytest
|
- name: Run Pytest
|
||||||
run: |
|
shell: bash -l {0}
|
||||||
python -m pytest
|
run: python -m pytest
|
||||||
|
|
Loading…
Reference in a new issue