From 32d5714f9faafc98cf8748b360f76dfe1d535091 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Thu, 15 May 2025 20:50:37 +0900 Subject: [PATCH 1/5] Actions: Replace broken easimon/maximize-build-space --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++------------ .github/workflows/daily.yml | 34 ++++++++++++++++++++++------------ .github/workflows/release.yml | 34 ++++++++++++++++++++++------------ 3 files changed, 66 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d18cd8..27fa93f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,18 +32,28 @@ jobs: steps: - name: Clean - uses: easimon/maximize-build-space@v10 - with: - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - root-reserve-mb: 16000 - swap-size-mb: 1024 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - remove-docker-images: 'true' + # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. + # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory + # where we need the most space + run: | + echo "Available storage before:" + sudo df -h + echo + + # Remove Removes .NET runtime and libraries + sudo rm -rf /usr/share/dotnet + # Removes Android SDKs and Tools + sudo rm -rf /usr/local/lib/android + # Removes GHC (Haskell) artifacts + sudo rm -rf /opt/ghc + # Removes CodeQL Action Bundles + sudo rm -rf /opt/hostedtoolcache/CodeQL + # Removes cached Docker images + sudo docker image prune --all --force + + echo "Available storage after:" + sudo df -h + echo - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 22a779f..eb460c7 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -29,18 +29,28 @@ jobs: steps: - name: Clean - uses: easimon/maximize-build-space@v10 - with: - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - root-reserve-mb: 16000 - swap-size-mb: 1024 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - remove-docker-images: 'true' + # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. + # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory + # where we need the most space + run: | + echo "Available storage before:" + sudo df -h + echo + + # Remove Removes .NET runtime and libraries + sudo rm -rf /usr/share/dotnet + # Removes Android SDKs and Tools + sudo rm -rf /usr/local/lib/android + # Removes GHC (Haskell) artifacts + sudo rm -rf /opt/ghc + # Removes CodeQL Action Bundles + sudo rm -rf /opt/hostedtoolcache/CodeQL + # Removes cached Docker images + sudo docker image prune --all --force + + echo "Available storage after:" + sudo df -h + echo - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c3dccc..6ed4913 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,18 +32,28 @@ jobs: steps: - name: Clean - uses: easimon/maximize-build-space@v10 - with: - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - root-reserve-mb: 16000 - swap-size-mb: 1024 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - remove-docker-images: 'true' + # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. + # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory + # where we need the most space + run: | + echo "Available storage before:" + sudo df -h + echo + + # Remove Removes .NET runtime and libraries + sudo rm -rf /usr/share/dotnet + # Removes Android SDKs and Tools + sudo rm -rf /usr/local/lib/android + # Removes GHC (Haskell) artifacts + sudo rm -rf /opt/ghc + # Removes CodeQL Action Bundles + sudo rm -rf /opt/hostedtoolcache/CodeQL + # Removes cached Docker images + sudo docker image prune --all --force + + echo "Available storage after:" + sudo df -h + echo - name: Checkout uses: actions/checkout@v4 From 73f6b9483c57b03f4d4ae54d69a5b38e539ffaf9 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Thu, 15 May 2025 21:04:56 +0900 Subject: [PATCH 2/5] Output status instead of comments --- .github/workflows/ci.yml | 14 +++++++++----- .github/workflows/daily.yml | 14 +++++++++----- .github/workflows/release.yml | 14 +++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27fa93f..2a369f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,15 +40,19 @@ jobs: sudo df -h echo - # Remove Removes .NET runtime and libraries + echo "Removing Removes .NET runtime and libraries..." sudo rm -rf /usr/share/dotnet - # Removes Android SDKs and Tools + + echo "Removing Android SDKs and Tools..." sudo rm -rf /usr/local/lib/android - # Removes GHC (Haskell) artifacts + + echo "Removing GHC (Haskell) artifacts..." sudo rm -rf /opt/ghc - # Removes CodeQL Action Bundles + + echo "Removing CodeQL Action Bundles..." sudo rm -rf /opt/hostedtoolcache/CodeQL - # Removes cached Docker images + + echo "Removing cached Docker images..." sudo docker image prune --all --force echo "Available storage after:" diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index eb460c7..ffc57f5 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -37,15 +37,19 @@ jobs: sudo df -h echo - # Remove Removes .NET runtime and libraries + echo "Removing Removes .NET runtime and libraries..." sudo rm -rf /usr/share/dotnet - # Removes Android SDKs and Tools + + echo "Removing Android SDKs and Tools..." sudo rm -rf /usr/local/lib/android - # Removes GHC (Haskell) artifacts + + echo "Removing GHC (Haskell) artifacts..." sudo rm -rf /opt/ghc - # Removes CodeQL Action Bundles + + echo "Removing CodeQL Action Bundles..." sudo rm -rf /opt/hostedtoolcache/CodeQL - # Removes cached Docker images + + echo "Removing cached Docker images..." sudo docker image prune --all --force echo "Available storage after:" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ed4913..ec99bd0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,15 +40,19 @@ jobs: sudo df -h echo - # Remove Removes .NET runtime and libraries + echo "Removing Removes .NET runtime and libraries..." sudo rm -rf /usr/share/dotnet - # Removes Android SDKs and Tools + + echo "Removing Android SDKs and Tools..." sudo rm -rf /usr/local/lib/android - # Removes GHC (Haskell) artifacts + + echo "Removing GHC (Haskell) artifacts..." sudo rm -rf /opt/ghc - # Removes CodeQL Action Bundles + + echo "Removing CodeQL Action Bundles..." sudo rm -rf /opt/hostedtoolcache/CodeQL - # Removes cached Docker images + + echo "Removing cached Docker images..." sudo docker image prune --all --force echo "Available storage after:" From a0589f45cd4a83f34eb7026b605234609df54863 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 17 May 2025 17:01:57 +0900 Subject: [PATCH 3/5] Try using /mnt for the builddir --- .github/workflows/ci.yml | 2 +- .github/workflows/daily.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a369f9..9ee3abe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index ffc57f5..d35d9f3 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -77,7 +77,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build -Dbranch=daily --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch=daily --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch=daily --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec99bd0..150682b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build -Dbranch=${RUNTIME_VERSION} --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch="${RUNTIME_VERSION}" --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch="${RUNTIME_VERSION}" --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . From 18f987fcd4235965689f73be0f1311d0facc1218 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 17 May 2025 20:20:46 +0900 Subject: [PATCH 4/5] Try fixing the state dir error Try fixing the following error when running meson The state dir (/home/runner/work/flatpak-platform/flatpak-platform/.flatpak-builder) is not on the same filesystem as the target dir (/mnt) --- .github/workflows/ci.yml | 2 +- .github/workflows/daily.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ee3abe..c42e5d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir --state-dir=/mnt/.flatpak-builder ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index d35d9f3..1909f9b 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -77,7 +77,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build -Dbranch=daily --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch=daily --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch=daily --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir --state-dir=/mnt/.flatpak-builder ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 150682b..4cddfca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: DISPLAY: "0:0" run: | meson setup build -Dbranch=${RUNTIME_VERSION} --cross-file="architectures/${{ matrix.configuration.architecture }}.crossfile" - sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch="${RUNTIME_VERSION}" --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir ./build/io.elementary.Sdk.json + sudo xvfb-run --auto-servernum flatpak-builder --arch=${{ matrix.configuration.architecture }} --default-branch="${RUNTIME_VERSION}" --disable-rofiles-fuse --keep-build-dirs --install-deps-from=flathub --ccache --repo=elementary /mnt/builddir --state-dir=/mnt/.flatpak-builder ./build/io.elementary.Sdk.json - name: Fix Permissions run: sudo chown -R runner:docker . From a500179f55a5e14711d1221cfcf1a28f6d04ce6e Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Mon, 2 Jun 2025 21:37:00 +0900 Subject: [PATCH 5/5] refactor cleanup action to be reusable (#203) --- .../actions/maximize-build-space/action.yml | 30 ++++++++++++++++++ .github/workflows/ci.yml | 31 ++----------------- .github/workflows/daily.yml | 31 ++----------------- .github/workflows/release.yml | 31 ++----------------- 4 files changed, 39 insertions(+), 84 deletions(-) create mode 100644 .github/actions/maximize-build-space/action.yml diff --git a/.github/actions/maximize-build-space/action.yml b/.github/actions/maximize-build-space/action.yml new file mode 100644 index 0000000..21d4ad2 --- /dev/null +++ b/.github/actions/maximize-build-space/action.yml @@ -0,0 +1,30 @@ +name: "Maximize Build Space" +description: "Remove large artifacts to maximize available build space on GitHub Actions runners." +runs: + using: "composite" + steps: + - name: Clean + shell: bash + run: | + echo "Available storage before:" + sudo df -h + echo + + echo "Removing Removes .NET runtime and libraries..." + sudo rm -rf /usr/share/dotnet + + echo "Removing Android SDKs and Tools..." + sudo rm -rf /usr/local/lib/android + + echo "Removing GHC (Haskell) artifacts..." + sudo rm -rf /opt/ghc + + echo "Removing CodeQL Action Bundles..." + sudo rm -rf /opt/hostedtoolcache/CodeQL + + echo "Removing cached Docker images..." + sudo docker image prune --all --force + + echo "Available storage after:" + sudo df -h + echo diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c42e5d6..0ac9211 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,37 +31,12 @@ jobs: architecture: aarch64 steps: - - name: Clean - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - run: | - echo "Available storage before:" - sudo df -h - echo - - echo "Removing Removes .NET runtime and libraries..." - sudo rm -rf /usr/share/dotnet - - echo "Removing Android SDKs and Tools..." - sudo rm -rf /usr/local/lib/android - - echo "Removing GHC (Haskell) artifacts..." - sudo rm -rf /opt/ghc - - echo "Removing CodeQL Action Bundles..." - sudo rm -rf /opt/hostedtoolcache/CodeQL - - echo "Removing cached Docker images..." - sudo docker image prune --all --force - - echo "Available storage after:" - sudo df -h - echo - - name: Checkout uses: actions/checkout@v4 + - name: Clean + uses: ./.github/actions/maximize-build-space + - name: Setup run: | sudo apt update diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 1909f9b..fbb5410 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -28,37 +28,12 @@ jobs: architecture: aarch64 steps: - - name: Clean - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - run: | - echo "Available storage before:" - sudo df -h - echo - - echo "Removing Removes .NET runtime and libraries..." - sudo rm -rf /usr/share/dotnet - - echo "Removing Android SDKs and Tools..." - sudo rm -rf /usr/local/lib/android - - echo "Removing GHC (Haskell) artifacts..." - sudo rm -rf /opt/ghc - - echo "Removing CodeQL Action Bundles..." - sudo rm -rf /opt/hostedtoolcache/CodeQL - - echo "Removing cached Docker images..." - sudo docker image prune --all --force - - echo "Available storage after:" - sudo df -h - echo - - name: Checkout uses: actions/checkout@v4 + - name: Clean + uses: ./.github/actions/maximize-build-space + - name: Setup run: | sudo apt update diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4cddfca..3cf71c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,36 +31,11 @@ jobs: if: github.event.pull_request.merged == true && true == contains(join(github.event.pull_request.labels.*.name), 'Release') steps: - - name: Clean - # Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions. - # This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory - # where we need the most space - run: | - echo "Available storage before:" - sudo df -h - echo - - echo "Removing Removes .NET runtime and libraries..." - sudo rm -rf /usr/share/dotnet - - echo "Removing Android SDKs and Tools..." - sudo rm -rf /usr/local/lib/android - - echo "Removing GHC (Haskell) artifacts..." - sudo rm -rf /opt/ghc - - echo "Removing CodeQL Action Bundles..." - sudo rm -rf /opt/hostedtoolcache/CodeQL - - echo "Removing cached Docker images..." - sudo docker image prune --all --force - - echo "Available storage after:" - sudo df -h - echo - - name: Checkout uses: actions/checkout@v4 + + - name: Clean + uses: ./.github/actions/maximize-build-space - name: Setup run: |