Skip to content

Commit 0ae8113

Browse files
fatbobmanclaude
andcommitted
fix: Use Swiftly for reliable Swift installation on Linux
- Replace manual download with Swiftly (official Swift installer) - Swiftly automatically handles platform detection and dependencies - Support for Ubuntu 24.04 (current GitHub Actions environment) - More reliable than manual downloads from swift.org - Follows official Swift.org installation recommendations Swiftly provides: - Automatic platform detection - Dependency management - Version management - Reliable installation across Linux distributions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 89564f6 commit 0ae8113

File tree

1 file changed

+14
-25
lines changed

1 file changed

+14
-25
lines changed

.github/workflows/linux-compatibility.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,29 @@ jobs:
2424
continue-on-error: true
2525
id: swift-setup
2626

27-
- name: Manual Swift installation (fallback)
27+
- name: Install Swift using Swiftly (fallback)
2828
if: steps.swift-setup.outcome == 'failure'
2929
run: |
30-
echo "Swift setup failed, attempting manual installation..."
30+
echo "Swift setup failed, installing Swift using Swiftly..."
3131
32-
# Install dependencies
33-
sudo apt-get update
34-
sudo apt-get install -y curl
32+
# Install Swiftly (official Swift installer)
33+
curl -L https://swiftlang.github.io/swiftly/swiftly-install.sh | bash
3534
36-
# Try Swift 6.0.2 (more stable release)
37-
SWIFT_URL="https://download.swift.org/swift-6.0.2-release/ubuntu2004/swift-6.0.2-RELEASE-ubuntu20.04.tar.gz"
38-
echo "Downloading Swift from: $SWIFT_URL"
35+
# Add Swiftly to PATH for current session
36+
export PATH="$HOME/.local/bin:$PATH"
3937
40-
# Download with better error handling
41-
if ! curl -fsSL -o swift.tar.gz "$SWIFT_URL"; then
42-
echo "Failed to download Swift, trying alternative version..."
43-
# Try Swift 6.0.1 as fallback
44-
SWIFT_URL="https://download.swift.org/swift-6.0.1-release/ubuntu2004/swift-6.0.1-RELEASE-ubuntu20.04.tar.gz"
45-
curl -fsSL -o swift.tar.gz "$SWIFT_URL"
46-
fi
38+
# Install Swift 6.0 using Swiftly
39+
echo "Installing Swift 6.0 using Swiftly..."
40+
$HOME/.local/bin/swiftly install 6.0
4741
48-
# Extract Swift
49-
echo "Extracting Swift..."
50-
tar xzf swift.tar.gz
42+
# Use Swift 6.0
43+
$HOME/.local/bin/swiftly use 6.0
5144
52-
# Find the extracted directory
53-
SWIFT_DIR=$(find . -maxdepth 1 -name "swift-6.0*-ubuntu20.04" -type d | head -1)
54-
echo "Swift directory: $SWIFT_DIR"
55-
56-
# Add to PATH
57-
echo "$PWD/$SWIFT_DIR/usr/bin" >> $GITHUB_PATH
45+
# Add Swift to PATH permanently
46+
echo "$HOME/.local/share/swiftly/toolchains/6.0/usr/bin" >> $GITHUB_PATH
5847
5948
# Verify installation
60-
"$PWD/$SWIFT_DIR/usr/bin/swift" --version
49+
$HOME/.local/share/swiftly/toolchains/6.0/usr/bin/swift --version
6150
6251
- name: Verify Swift installation
6352
run: |

0 commit comments

Comments
 (0)