Skip to content

Commit

Permalink
Fisrt attempt updating CI for Conda
Browse files Browse the repository at this point in the history
  • Loading branch information
f-PLT committed May 28, 2024
1 parent e619218 commit 79b2d62
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 24 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,47 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'

- name: Install Poetry
run: |
pip install poetry
- name: Configure Poetry
run: |
poetry config virtualenvs.create false
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: climateset
use-mamba: true

- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Conda env
uses: actions/cache@v3
with:
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:
CACHE_NUMBER: 0
id: cache

- name: Update environment
run:
mamba env update -n climateset -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install dependencies
run: |
make install
make CONDA_TOOL=mamba install
- name: Run linting checks
run: |
Expand Down
46 changes: 34 additions & 12 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,47 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'

- name: Install Poetry
run: |
pip install poetry
- name: Configure Poetry
run: |
poetry config virtualenvs.create false
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: climateset
use-mamba: true

- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Conda env
uses: actions/cache@v3
with:
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:
CACHE_NUMBER: 0
id: cache

- name: Update environment
run:
mamba env update -n climateset -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install dependencies
run: |
make install
make CONDA_TOOL=mamba install
- name: Run Pre-commit checks
run: |
Expand Down

0 comments on commit 79b2d62

Please sign in to comment.