diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43b7a82..8340641 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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<> $GITHUB_ENV cat imex_version.txt >> $GITHUB_ENV echo 'EOF' >> $GITHUB_ENV @@ -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' @@ -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 @@ -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