Skip to content

Commit

Permalink
Use official conda-action
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth committed Aug 20, 2024
1 parent 75ae049 commit 4049d47
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 49 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,24 @@ jobs:
packages:
name: Build Packages
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Conda
run: ./ci/setup-conda.sh
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
channel-priority: strict
channels: conda-forge
- name: Install global deps
run: |
conda install conda-build anaconda-client
conda info -a
- name: Build Pytest-Mpl
run: ./ci/build-package.sh pytest-mpl
env:
Expand Down Expand Up @@ -44,11 +57,24 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.os, 'windows') }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Conda
run: ./ci/setup-conda.sh
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
channel-priority: strict
channels: conda-forge
- name: Install global deps
run: |
conda install conda-build anaconda-client
conda info -a
- name: Make Env
run: ./ci/make-env.sh
env:
Expand Down
8 changes: 0 additions & 8 deletions ci/activate-conda.sh

This file was deleted.

28 changes: 7 additions & 21 deletions ci/build-package.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
#!/bin/bash
set -e

cd "$(dirname "$0")"
source ./activate-conda.sh
function RQ() {
echo ">>>" "$@"
"$@"
}

cd ..
cd "$(dirname "$0")"/..

PKG="$1"
MF="./build/$1/meta.yaml"

CUR_NO="$(grep number: "$MF" | head -n1 | cut -d: -f2 | xargs)"
CUR_VER="$(grep version: "$MF" | cut -d'"' -f2)"

CUR_PY="py"
if [[ "$PKG" == "oggm-deps" ]]; then
CUR_PY="oggm"
else
CUR_NO="${CUR_PY}_${CUR_NO}"
fi

LATEST_VER="$(conda search -c oggm --override-channels "$PKG" | grep "$CUR_PY" | tail -n1)"

if [[ "$(echo $LATEST_VER | cut -d' ' -f2)" == "$CUR_VER" ]] && [[ "$(echo $LATEST_VER | cut -d' ' -f3)" == "$CUR_NO" ]]; then
echo "Anaconda already has ${CUR_VER} ${CUR_NO}, exiting early."
exit 0
fi

export CONDA_BLD_PATH="$PWD/conda-bld"
rm -rf "$CONDA_BLD_PATH"
Expand All @@ -35,6 +19,8 @@ echo
echo "Done building"
echo

anaconda --version

for i in "$CONDA_BLD_PATH"/*/*.tar.bz2; do
echo
echo "Uploading $(basename $i)"
Expand Down
8 changes: 5 additions & 3 deletions ci/make-env.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
set -e

cd "$(dirname "$0")"
source ./activate-conda.sh
function RQ() {
echo ">>>" "$@"
"$@"
}

cd ..
cd "$(dirname "$0")"/..

export MPLBACKEND=agg
export OGGM_USE_MP_SPAWN=1
Expand Down
15 changes: 0 additions & 15 deletions ci/setup-conda.sh

This file was deleted.

0 comments on commit 4049d47

Please sign in to comment.