From 4049d47287d5fc09e5aa686f6e176906e1c75ec1 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Tue, 20 Aug 2024 21:17:43 +0200 Subject: [PATCH] Use official conda-action --- .github/workflows/package.yml | 30 ++++++++++++++++++++++++++++-- ci/activate-conda.sh | 8 -------- ci/build-package.sh | 28 +++++++--------------------- ci/make-env.sh | 8 +++++--- ci/setup-conda.sh | 15 --------------- 5 files changed, 40 insertions(+), 49 deletions(-) delete mode 100755 ci/activate-conda.sh delete mode 100755 ci/setup-conda.sh diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index bdbfae5..08a35a7 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -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: @@ -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: diff --git a/ci/activate-conda.sh b/ci/activate-conda.sh deleted file mode 100755 index 478704e..0000000 --- a/ci/activate-conda.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -source "${CONDA}/etc/profile.d/conda.sh" -conda activate base - -function RQ() { - echo ">>>" "$@" - "$@" -} diff --git a/ci/build-package.sh b/ci/build-package.sh index 22e8559..fd397ed 100755 --- a/ci/build-package.sh +++ b/ci/build-package.sh @@ -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" @@ -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)" diff --git a/ci/make-env.sh b/ci/make-env.sh index cd5253f..e6dfa8e 100755 --- a/ci/make-env.sh +++ b/ci/make-env.sh @@ -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 diff --git a/ci/setup-conda.sh b/ci/setup-conda.sh deleted file mode 100755 index bffdc6f..0000000 --- a/ci/setup-conda.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -cd "$(dirname "$0")" -source ./activate-conda.sh - -if [[ "${RUNNER_OS}" != "Windows" ]]; then - RQ sudo chown -R "$(id -u):$(id -g)" "$CONDA" -fi - -RQ conda config --set always_yes yes --set changeps1 no -RQ conda update -q conda -RQ conda update -c conda-forge -q --all -RQ conda install -c conda-forge -q conda-build "conda-verify>=3" anaconda-client -RQ conda info -a \ No newline at end of file