Skip to content

Commit e91914e

Browse files
committed
harden conda workflow against transient solver failures
1 parent f792c4a commit e91914e

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/conda.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,47 @@ jobs:
6464
auto-activate-base: true
6565

6666
- name: Install conda-build
67-
run: conda install -n base -y conda-build
67+
run: conda install -n base -y --override-channels -c conda-forge conda-build
6868

6969
- name: Configure Linux ARM OpenBLAS
7070
if: ${{ matrix.openblas_coretype != '' }}
7171
run: echo "OPENBLAS_CORETYPE=${{ matrix.openblas_coretype }}" >> "$GITHUB_ENV"
7272

7373
- name: Render recipe
74-
run: conda render -c conda-forge --variants "${{ matrix.variants }}" recipe
74+
run: |
75+
retry_conda() {
76+
local attempt
77+
for attempt in 1 2 3; do
78+
if "$@"; then
79+
return 0
80+
fi
81+
if [ "${attempt}" -eq 3 ]; then
82+
return 1
83+
fi
84+
conda clean -y --index-cache --packages --tarballs
85+
sleep $((attempt * 20))
86+
done
87+
}
88+
89+
retry_conda conda render --override-channels -c conda-forge --variants "${{ matrix.variants }}" recipe
7590
7691
- name: Build package
7792
run: |
78-
conda build -c conda-forge --no-anaconda-upload \
79-
--variants "${{ matrix.variants }}" \
80-
recipe
93+
retry_conda() {
94+
local attempt
95+
for attempt in 1 2 3; do
96+
if "$@"; then
97+
return 0
98+
fi
99+
if [ "${attempt}" -eq 3 ]; then
100+
return 1
101+
fi
102+
conda clean -y --index-cache --packages --tarballs
103+
sleep $((attempt * 20))
104+
done
105+
}
106+
107+
retry_conda conda build --override-channels -c conda-forge --no-anaconda-upload --variants "${{ matrix.variants }}" recipe
81108
82109
- name: Upload conda test logs
83110
uses: actions/upload-artifact@v7

0 commit comments

Comments
 (0)