setup-xcode icon indicating copy to clipboard operation
setup-xcode copied to clipboard

remove unused xcode versions

Open Aaron-Ritter opened this issue 1 year ago • 3 comments

Would it be possible to implement something which removes anything except the version i wanted to initialize. I created this workaround for now:

      - name: Initialize latest xcode
        uses: maxim-lobanov/[email protected]
        with:
          xcode-version: ${{ matrix.xcode }}

      - name: Remove old xcode versions
        run: |
          echo "Searching for Xcode versions:"
          find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
          echo "Removing old Xcode versions..."
          find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf
          echo "Available Xcode versions after removal:"
          find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1

For reference https://github.com/actions/runner-images/issues/2840

Aaron-Ritter avatar Sep 07 '24 10:09 Aaron-Ritter

+1 for this.

Lately GitHub runners have been failing due to space constraints (with no change on our part). And it seems GitHub's solution is to just delete stuff on the runner that we don't need.

Since each Mac runner has a bunch of versions of Xcode installed this would be nice.

BrentMifsud avatar Sep 07 '24 15:09 BrentMifsud

@BrentMifsud i agree that space constraints are a issue, and this helps definitely to free up space in fact much more space than the initial 14G free space available in the runner, but i think some of the real underlying reasons are in my case for example:

github/codeql-action/[email protected] uses 3G swift-actions/[email protected] uses 10G

Which is almost all of the 14G free macos-latest runner space.

Aaron-Ritter avatar Sep 07 '24 18:09 Aaron-Ritter

for reference https://github.com/swift-actions/setup-swift/issues/682

Aaron-Ritter avatar Sep 07 '24 19:09 Aaron-Ritter