WCRP-CMIP / CMIP6Plus_CVs

Controlled Vocabularies (CVs) for use in CMIP6Plus
Creative Commons Attribution 4.0 International
3 stars 4 forks source link

Technical: Caching CMOR for automatic checking and action perfomance. #22

Closed wolfiex closed 4 months ago

wolfiex commented 8 months ago

It is possible to cache an environment, rather than having to recompute and install it each time. This should greatly improve the actions performance.

Reference: https://github.com/actions/cache

An example script on how this may be approached (FOR REFERENCE ONLY)

name: Build Conda Environment

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2

    - name: Cache Conda environment
      uses: actions/cache@v2
      with:
        path: |
          ~/.conda/pkgs
          ~/.conda/envs
        key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml') }}
        restore-keys: |
          ${{ runner.os }}-conda-

    - name: Set up Miniconda
      run: |
        wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
        bash miniconda.sh -b -p $HOME/miniconda
        source $HOME/miniconda/etc/profile.d/conda.sh
        hash -r
        conda config --set always_yes yes --set changeps1 no
        conda update -q conda

    - name: Create Conda environment
      run: |
        conda env create -f path/to/your/environment.yml -n your_environment_name
        conda activate your_environment_name

    # ... rest of the action or build steps. 
durack1 commented 8 months ago

@wolfiex Chris (@mauzey1) is pretty experienced with creating these test suites using CircleCI, so likely has some recipes that could be useful to shortcut the learning curve

wolfiex commented 4 months ago

Closing for now, Issue will be re-opened later when writing CMOR tests.