From 4f96cd102f189bc5b5ba624e8494593dd4d3d57a Mon Sep 17 00:00:00 2001 From: jmtcsngr Date: Thu, 28 Nov 2024 17:17:40 +0000 Subject: [PATCH] switch default conda for miniforge --- .github/workflows/testing.yml | 34 +++++++++++++++++++--------------- scripts/install_miniforge.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 15 deletions(-) create mode 100755 scripts/install_miniforge.sh diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index aa980b6..45f0758 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -16,36 +16,40 @@ jobs: env: NPM_CONFIG_PREFIX: "$HOME/.npm-global" + CONDA_HOME: "$HOME/conda" + CONDA_TEST_ENV: test-environment name: Node ${{ matrix.node }} on ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + fetch-depth: '0' - - name: Initialize Miniconda + - name: "Install Miniforge" run: | - echo 'source $CONDA/etc/profile.d/conda.sh' >> "$HOME/.bash_profile" - - name: Cache conda - id: minicondaCache + CONDA_HOME=${{ env.CONDA_HOME }} ./scripts/install_miniforge.sh + echo 'source "${{ env.CONDA_HOME }}/etc/profile.d/conda.sh"' >> "$HOME/.bash_profile" + + - name: "Cache Conda" + id: miniforgeCache uses: actions/cache@v4 with: path: | ~/conda/pkgs ~/conda/envs - key: ${{ matrix.os }}-build-miniconda + key: ${{ runner.os }}-build-miniforge - - name: install conda client and set up conda environment + - name: "Install Conda packages" run: | - conda config --prepend pkgs_dirs ~/conda/pkgs - conda config --prepend envs_dirs ~/conda/envs - conda config --set auto_update_conda False - conda info - conda create -y -n "$CONDA_TEST_ENV" - conda install -y -n "$CONDA_TEST_ENV" nodejs=="${{ matrix.node }}" - env: - CONDA_TEST_ENV: test-environment + conda config --prepend pkgs_dirs ${{ env.CONDA_HOME }}/pkgs + conda config --prepend envs_dirs ${{ env.CONDA_HOME }}/envs + conda info + conda create -y -n "${{ env.CONDA_TEST_ENV }}" + conda install -y -n "${{ env.CONDA_TEST_ENV }}" nodejs=="${{ matrix.node }}" - name: Run install scripts run: | + conda activate "${{ env.CONDA_TEST_ENV }}" mkdir -p "$NPM_CONFIG_PREFIX" npm install -g bower grunt-cli node-qunit-phantomjs npm install @@ -54,7 +58,7 @@ jobs: - name: run script run: | + conda activate "${{ env.CONDA_TEST_ENV }}" export PATH="$NPM_CONFIG_PREFIX/bin:$PATH" - conda activate "$CONDA_TEST_ENV" conda info --envs ${GITHUB_WORKSPACE}/scripts/script.sh diff --git a/scripts/install_miniforge.sh b/scripts/install_miniforge.sh new file mode 100755 index 0000000..1e19a3c --- /dev/null +++ b/scripts/install_miniforge.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Once installed, the Conda environment can be activated by running: +# +# source $CONDA_HOME/etc/profile.d/conda.sh +# +# conda activate +set -ex +MINIFORGE_VERSION="24.9.0-0" +MINIFORGE_SHA256="77fb505f6266ffa1b5d59604cf6ba25948627e908928cbff148813957b1c28af" +CONDA_HOME=${CONDA_HOME:="$HOME/conda"} +export CONDA_HOME +CONDARC="$HOME/.condarc" +export CONDARC +cat < "$CONDARC" +auto_update_conda: false +always_yes: true +ssl_verify: true +show_channel_urls: true +channels: + - conda-forge +EOF +curl -sSL "https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Mambaforge-${MINIFORGE_VERSION}-Linux-x86_64.sh" -o ./miniforge.sh +sha256sum ./miniforge.sh | grep "$MINIFORGE_SHA256" +/bin/bash ./miniforge.sh -b -p "$CONDA_HOME" +rm ./miniforge.sh