Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[PLAT-741] Remove needless packages and tools #210

Merged
merged 7 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/scripts/free_disk_space.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

get_available_space() {
echo $(df -a $1 | awk 'NR > 1 {avail+=$4} END {print avail}')
}

BEFORE_SPACE=$(get_available_space)

# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y \
azure-cli \
google-cloud-sdk \
hhvm \
google-chrome-stable \
firefox \
powershell \
mono-devel \
libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean

# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
echo "Removing large directories"
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/graalvm
sudo rm -rf /usr/local/.ghcup /opt/ghc
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/lib/node_modules

# REF: https://github.com/actions/runner-images/issues/2875#issuecomment-1163392159
echo "Removing tool cache"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"

echo "Removing swap storage"
sudo swapoff -a
sudo rm -f /mnt/swapfile

echo "Finding space freed up"
AFTER_SPACE=$(get_available_space)
printf "%'.f\n" $((AFTER_SPACE - BEFORE_SPACE))
9 changes: 6 additions & 3 deletions .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ concurrency:
env:
CARGO_ARGS: ${{ github.ref == 'refs/heads/develop' && '--release' || '' }}
CARGO_TERM_COLOR: always
SKIP_WASM_BUILD: 1

jobs:
fmt:
Expand All @@ -40,8 +41,9 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
with:
path: |
Expand All @@ -60,8 +62,9 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
with:
path: |
Expand All @@ -72,7 +75,7 @@ jobs:
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-test-
- run: cargo test --workspace --all-features --all-targets ${{ env.CARGO_ARGS }} --jobs 1
- run: cargo test --workspace --all-features --all-targets ${{ env.CARGO_ARGS }}

coverage:
if: ${{ !startsWith(github.head_ref, 'release/') }}
Expand Down