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 9db0d9a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 50 deletions.
29 changes: 27 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 -el {0}
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: oggmbuild
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,23 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.os, 'windows') }}
defaults:
run:
shell: bash -el {0}
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
activate-environment: oggmbuild
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
2 changes: 1 addition & 1 deletion build/oggm/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package:
name: {{ name|lower }}
version: {{ version }}
version: 1.6.1

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
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 9db0d9a

Please sign in to comment.