Skip to content

Commit 0a20b7f

Browse files
CI: Remove old scipy-wheels-nightly uploads to ensure space
Remove all but the last "${N_LATEST_UPLOADS}" package version uploads to the matplotlib scipy-wheels-nightly index to ensure space. To do this, rely on the output form of `anaconda show` to be able to filter on the item delimiter character sequence for each version currently uploaded. As an explicit example: ``` $ anaconda show scipy-wheels-nightly/matplotlib Using Anaconda API: https://api.anaconda.org Name: matplotlib Summary: Access: public Package Types: pypi Versions: + 3.6.0.dev2553+g3245d395d9 + 3.6.0.dev2569+g3522217386 + 3.6.0.dev2573+g3eadeacc06 To install this package with pypi run: pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple matplotlib ``` shows that by filtering on '+' and then stripping ' + ' one can obtain a newline separated list of all package uploads, where they _most recent_ uploads are listed last. After stripping off the "${N_LATEST_UPLOADS}" lines that correspond to the package versions to keep for testing, the remaining (older) package uploads can be removed with `anaconda remove`. Resolves the space problem in https://github.com/matplotlib/matplotlib Issue 22757
1 parent 3522217 commit 0a20b7f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/nightlies.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,22 @@ jobs:
6363
--user scipy-wheels-nightly \
6464
--skip-existing \
6565
dist/matplotlib-*.whl
66+
67+
- name: Remove old uploads to save space
68+
shell: bash
69+
run: |
70+
N_LATEST_UPLOADS=5
71+
# Remove all _but_ the last "${N_LATEST_UPLOADS}" package versions
72+
# N.B.: `anaconda show` places the newest packages at the bottom of the output
73+
# of the 'Versions' section and package versions are preceded with a ' + '.
74+
anaconda show scipy-wheels-nightly/matplotlib &> >(grep '+') | \
75+
sed 's/.* + //' | \
76+
head --lines "-${N_LATEST_UPLOADS}" > remove-package-versions.txt
77+
78+
if [ -s remove-package-versions.txt ]; then
79+
while LANG=C IFS= read -r package_version ; do
80+
anaconda --token ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} remove \
81+
--force \
82+
"scipy-wheels-nightly/matplotlib/${package_version}"
83+
done <remove-package-versions.txt
84+
fi

0 commit comments

Comments
 (0)