github actions: don't free disk space on CI unless needed for large builds

This commit is contained in:
Butta 2021-06-28 02:40:07 +05:30 committed by Leonid Pliushch
parent 915977b72a
commit 2890f0748f

View File

@ -25,12 +25,6 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 1000 fetch-depth: 1000
- name: Free additional disk space on host
run: |
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php)') \
liblldb-6.0 libllvm6.0:amd64 mono-runtime-common monodoc-manual powershell ruby
sudo apt autoremove -yq
sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
- name: Build - name: Build
run: | run: |
BASE_COMMIT=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH") BASE_COMMIT=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
@ -114,6 +108,14 @@ jobs:
mv ./deleted_packages.txt.tmp ./deleted_packages.txt mv ./deleted_packages.txt.tmp ./deleted_packages.txt
fi fi
if grep -qP '^rust$' ./built_packages.txt ; then
echo "Free additional disk space on host"
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php)') \
liblldb-6.0 libllvm6.0:amd64 mono-runtime-common monodoc-manual powershell ruby
sudo apt autoremove -yq
sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
fi
if [ -f ./built_packages.txt ]; then if [ -f ./built_packages.txt ]; then
./scripts/lint-packages.sh $(cat ./built_packages.txt | awk '{print "packages/"$1"/build.sh"}') ./scripts/lint-packages.sh $(cat ./built_packages.txt | awk '{print "packages/"$1"/build.sh"}')
./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} $(cat ./built_packages.txt) ./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} $(cat ./built_packages.txt)