Skip to content
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
50 changes: 50 additions & 0 deletions .github/actions/free-disk-space/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Free disk space"
description: "Remove pre-installed packages to free disk space on GitHub-hosted runners"

runs:
using: "composite"
steps:
- name: "Free disk space"
shell: bash
run: |
set -euo pipefail

sudo swapoff -a || true
sudo rm -f /swapfile || true

mapfile -t purge_list < <(dpkg -l | awk '
/^ii/ {
p=$2
if (p ~ /^(dotnet-.*|llvm-.*|php.*|mongodb-.*|mysql-.*)$/) print p
}')
sudo apt-get purge -y "${purge_list[@]:-}" azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true
sudo apt-get autoremove -y --purge
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

sudo rm -rf \
/opt/ghc \
/opt/hostedtoolcache/CodeQL \
/usr/local/.ghcup \
/usr/local/graalvm \
/usr/local/lib/android \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
~/.cache/*

docker ps -q | xargs -r docker stop || true
docker system prune -af --volumes || true
docker builder prune -af || true
docker buildx prune -af || true

- name: "Check disk space"
shell: bash
run: |
echo ""

df -Th | awk 'NR == 1; NR > 1 {print $0 | "sort -n"}'

echo ""

lsblk -o MOUNTPOINT,FSTYPE,FSSIZE,FSAVAIL,FSUSE%,TYPE,NAME,ROTA,SIZE,MODEL,UUID
72 changes: 19 additions & 53 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,51 +54,17 @@ jobs:
- x86_64-unknown-linux-musl

steps:
- name: "Checkout code"
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: true

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Free disk space"
run: |
set -euo pipefail

sudo swapoff -a || true
sudo rm -f /swapfile || true

mapfile -t purge_list < <(dpkg -l | awk '
/^ii/ {
p=$2
if (p ~ /^(dotnet-.*|llvm-.*|php.*|mongodb-.*|mysql-.*)$/) print p
}')
sudo apt-get purge -y "${purge_list[@]:-}" azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true
sudo apt-get autoremove -y --purge
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

sudo rm -rf \
/opt/ghc \
/opt/hostedtoolcache/CodeQL \
/usr/local/.ghcup \
/usr/local/graalvm \
/usr/local/lib/android \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
~/.cache/*

docker ps -q | xargs -r docker stop || true
docker system prune -af --volumes || true
docker builder prune -af || true
docker buildx prune -af || true

- name: "Check disk space"
run: |
echo ""

df -Th | awk 'NR == 1; NR > 1 {print $0 | "sort -n"}'

echo ""

lsblk -o MOUNTPOINT,FSTYPE,FSSIZE,FSAVAIL,FSUSE%,TYPE,NAME,ROTA,SIZE,MODEL,UUID
uses: ./.github/actions/free-disk-space

- name: "Setup environment (release)"
if: endsWith(github.ref, '/release')
Expand All @@ -115,12 +81,6 @@ jobs:
run: |
echo "DATA_FULL_DOMAIN=https://data.master.clades.nextstrain.org/v3" >> $GITHUB_ENV

- name: "Checkout code"
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: true

- name: "Get docker build checksum"
id: docker-build-checksum
run: echo "checksum=$(./scripts/docker_build_checksum.sh)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -197,15 +157,18 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Checkout code"
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: true

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Free disk space"
uses: ./.github/actions/free-disk-space

- name: "Get docker build checksum"
id: docker-build-checksum
run: echo "checksum=$(./scripts/docker_build_checksum.sh)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -248,15 +211,18 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Checkout code"
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: true

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Free disk space"
uses: ./.github/actions/free-disk-space

- name: "Get docker build checksum"
id: docker-build-checksum
run: echo "checksum=$(./scripts/docker_build_checksum.sh)" >> $GITHUB_OUTPUT
Expand Down