Skip to content

Build Conda Environment #385

Build Conda Environment

Build Conda Environment #385

name: Build Conda Environment
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # Runs daily at midnight UTC
jobs:
build_conda_env:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
# Test building on Mac Intel as well.
os: [ubuntu-latest, macos-13]
python-version: ["3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: goats
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
miniforge-version: latest
activate-environment: goats-env
channels: conda-forge, http://astroconda.gemini.edu/public
channel-priority: strict
auto-activate-base: false
conda-remove-defaults: "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@v4
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('goats/ci_environment.yaml', 'goats/pyproject.toml') }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if goats/ci_environment.yaml has not changed.
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: |
conda env update -n goats-env -f goats/ci_environment.yaml
cd goats
uv pip install -v -e . --group dev
if: steps.cache.outputs.cache-hit != 'true'
- name: Test environment installation
run: |
conda list -n goats-env