Skip to content

Commit

Permalink
use miniforge (#17)
Browse files Browse the repository at this point in the history
using miniforge in CI
  • Loading branch information
fschlimb authored Sep 24, 2024
1 parent 42a3edd commit 38362e7
Showing 1 changed file with 13 additions and 29 deletions.
42 changes: 13 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: Sharpy CI
run-name: ${{ github.actor }} CI for sharpy
permissions: read-all

on:
push:
branches:
- main
pull_request:

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

env:
IMEX_CACHE_NUMBER: 4 # Increase to reset cache

jobs:
build_and_test:
runs-on: ubuntu-22.04
Expand All @@ -25,8 +29,6 @@ jobs:
run: |
INSTALLED_DIR="$(realpath $GITHUB_WORKSPACE)/third_party/install"
echo "INSTALLED_DIR=$INSTALLED_DIR" >> "$GITHUB_ENV"
CONDA_ROOT="$(realpath $GITHUB_WORKSPACE/..)/install/miniconda3"
echo "CONDA_ROOT=$CONDA_ROOT" >> "$GITHUB_ENV"
echo 'IMEX_SHA<<EOF' >> $GITHUB_ENV
cat imex_version.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
Expand All @@ -36,29 +38,17 @@ jobs:
with:
path: third_party/install/**
key: ${{ runner.os }}-build-imex-${{ env.IMEX_CACHE_NUMBER }}-${{ env.IMEX_SHA }}
- name: Miniconda
run: |
env
rm -rf $CONDA_ROOT
cd $GITHUB_WORKSPACE/..
rm -f Miniconda3-*.sh
# CPKG=Miniconda3-latest-Linux-x86_64.sh
CPKG=Miniconda3-py311_24.3.0-0-Linux-x86_64.sh
wget -q https://repo.anaconda.com/miniconda/$CPKG
bash $CPKG -u -b -f -p $CONDA_ROOT
export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
conda install -c conda-forge --override-channels python git-lfs 'conda-build<=24.1.2'
# aahhhh bug in conda somewhere
sed -i "s,\#\!/usr/bin/env python,#\!$CONDA_ROOT/bin/python," $CONDA_ROOT/*bin/conda
conda clean --all -y
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
# environment-file: etc/example-environment.yml
- name: Build SHARPY
run: |
env
export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
conda install -y conda-build
cd conda-recipe
conda build --numpy 1.26 -c conda-forge --override-channels --no-anaconda-upload --no-test .
conda build --numpy 1.26 --no-anaconda-upload --no-test .
- name: Save IMEX cache
uses: actions/cache/save@v3
if: steps.cache-imex.outputs.cache-hit != 'true'
Expand All @@ -67,14 +57,10 @@ jobs:
key: ${{ runner.os }}-build-imex-${{ env.IMEX_CACHE_NUMBER }}-${{ env.IMEX_SHA }}
- name: Install SHARPY
run: |
export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
conda create --use-local -c conda-forge --override-channels -n sharpy -v sharpy pytest pytest-timeout
conda create --use-local -c file://${CONDA_PREFIX}/conda-bld/ -n sharpy -v sharpy pytest pytest-timeout
conda activate sharpy
- name: Test SHARPY (pytest)
run: |
export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
conda activate sharpy
cd test
pytest . -v -s --timeout=30
Expand All @@ -85,8 +71,6 @@ jobs:
cd -
- name: Run examples
run: |
export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
conda activate sharpy
cd examples
SHARPY_FALLBACK=numpy python -u ./stencil-2d.py 5 1024 star 4
Expand Down

0 comments on commit 38362e7

Please sign in to comment.