Skip to content

Commit d54519b

Browse files
committed
DOC: Add CI workflow for downloading and setting up micromamba
1 parent 93239cd commit d54519b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
- name: Download micromamba (with retries)
2+
shell: bash
3+
run: |
4+
set -euo pipefail
5+
RETRIES=5
6+
URL="https://micromamba.snakepit.net/api/micromamba/linux-64/latest" # linux binary endpoint
7+
OUT="$RUNNER_TEMP/micromamba.tar.bz2"
8+
i=0
9+
until [ $i -ge $RETRIES ]
10+
do
11+
echo "Attempt $((i+1))..."
12+
if curl -fSL "$URL" -o "$OUT"; then
13+
echo "Downloaded micromamba"
14+
break
15+
fi
16+
i=$((i+1))
17+
sleep $((i * 2))
18+
done
19+
if [ ! -f "$OUT" ]; then
20+
echo "Failed to download micromamba after $RETRIES attempts"
21+
exit 1
22+
fi
23+
mkdir -p "$RUNNER_TEMP/micromamba"
24+
tar -xjf "$OUT" -C "$RUNNER_TEMP/micromamba" --strip-components=1
25+
export MAMBA_ROOT_PREFIX="$RUNNER_TEMP/micromamba-root"
26+
mkdir -p "$MAMBA_ROOT_PREFIX"
27+
echo "Adding micromamba to PATH"
28+
echo "$RUNNER_TEMP/micromamba/bin" >> $GITHUB_PATH
29+
30+
- name: Create env with micromamba
31+
run: |
32+
micromamba create -y -n ci-env python=3.10
33+
micromamba activate ci-env
34+
micromamba install -y -n ci-env -c conda-forge <your-deps-here>

0 commit comments

Comments
 (0)