Skip to content

Commit

Permalink
switch default conda for miniforge
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtcsngr committed Nov 28, 2024
1 parent 24cebc5 commit 4f96cd1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
26 changes: 26 additions & 0 deletions scripts/install_miniforge.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF > "$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

0 comments on commit 4f96cd1

Please sign in to comment.