Skip to content

Commit d0d1ca8

Browse files
committed
Update CI workflows to Ubuntu 22.04 for Colab GLIBC 2.35 compatibility
1 parent 33065f3 commit d0d1ca8

File tree

2 files changed

+73
-10
lines changed

2 files changed

+73
-10
lines changed

.github/workflows/build-release.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
# =============================================================
2525
build-linux:
2626
name: Build SwiftIR (Linux x86_64)
27-
runs-on: ubuntu-24.04
27+
runs-on: ubuntu-22.04
2828

2929
steps:
3030
- name: Checkout Repository
@@ -38,6 +38,10 @@ jobs:
3838
3939
- name: Install System Dependencies
4040
run: |
41+
# Add LLVM apt repository for clang-18 on Ubuntu 22.04
42+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
43+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm-18.list
44+
4145
sudo apt-get update
4246
sudo apt-get install -y \
4347
build-essential cmake ninja-build git wget curl \
@@ -49,7 +53,7 @@ jobs:
4953
5054
- name: Install Swift
5155
run: |
52-
# Download Swift directly instead of using swiftly (Ubuntu 24.04 not supported by swiftly)
56+
# Download Swift development snapshot for Ubuntu 22.04
5357
SWIFT_URL="https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a-ubuntu22.04.tar.gz"
5458
5559
echo "Downloading Swift development snapshot..."
@@ -413,12 +417,12 @@ jobs:
413417
test-package:
414418
name: Test Runtime Package (Ubuntu)
415419
needs: build-linux
416-
runs-on: ubuntu-24.04
420+
runs-on: ubuntu-22.04
417421

418422
steps:
419423
- name: Install Swift
420424
run: |
421-
# Download Swift directly instead of using swiftly (Ubuntu 24.04 not supported by swiftly)
425+
# Download Swift development snapshot for Ubuntu 22.04
422426
SWIFT_URL="https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a-ubuntu22.04.tar.gz"
423427
424428
echo "Downloading Swift development snapshot..."
@@ -477,14 +481,18 @@ jobs:
477481
test-sdk:
478482
name: Test SDK Package (Ubuntu)
479483
needs: build-linux
480-
runs-on: ubuntu-24.04
484+
runs-on: ubuntu-22.04
481485

482486
steps:
483487
- name: Checkout Repository
484488
uses: actions/checkout@v4
485489

486490
- name: Install System Dependencies
487491
run: |
492+
# Add LLVM apt repository for clang-18 on Ubuntu 22.04
493+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
494+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm-18.list
495+
488496
sudo apt-get update
489497
sudo apt-get install -y \
490498
build-essential cmake ninja-build git wget curl \

.github/workflows/ubuntu-build-dependencies.yml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
jobs:
1717
build-dependencies:
1818
name: Build LLVM, StableHLO, and XLA Dependencies
19-
runs-on: ubuntu-24.04
19+
runs-on: ubuntu-22.04
2020

2121
steps:
2222
# ============================================================
@@ -57,11 +57,17 @@ jobs:
5757
- name: Install System Dependencies
5858
run: |
5959
sudo apt-get update
60+
61+
# Add LLVM apt repository for clang-18 on Ubuntu 22.04
62+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
63+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm-18.list
64+
sudo apt-get update
65+
6066
sudo apt-get install -y \
6167
build-essential cmake ninja-build git wget curl pkg-config tzdata \
6268
clang-18 llvm-18-dev lld-18 \
6369
libc++-18-dev libc++abi-18-dev \
64-
libc6-dev libstdc++-13-dev \
70+
libc6-dev libstdc++-11-dev \
6571
libicu-dev libssl-dev libxml2-dev \
6672
libcurl4-openssl-dev libz-dev libzstd-dev \
6773
libncurses-dev zlib1g-dev libsqlite3-dev libpython3-dev \
@@ -393,7 +399,52 @@ jobs:
393399
# swift test
394400
395401
# ============================================================
396-
# 7. Package and Upload Artifacts
402+
# 7. Build Pre-compiled Swift Modules
403+
# ============================================================
404+
405+
- name: Build Swift Modules for Jupyter Integration
406+
run: |
407+
export PATH="$HOME/.local/bin:$PATH"
408+
export SWIFTIR_DEPS_DIR=/opt/swiftir-deps
409+
export LD_LIBRARY_PATH=/opt/swiftir-deps/lib:$LD_LIBRARY_PATH
410+
export LIBRARY_PATH=/opt/swiftir-deps/lib:$LIBRARY_PATH
411+
export CPATH=/opt/swiftir-deps/include:$CPATH
412+
413+
echo "Building Swift modules in release mode..."
414+
swift build -c release
415+
416+
# Create swift-modules directory in deps
417+
mkdir -p /opt/swiftir-deps/swift-modules
418+
419+
# Copy .swiftmodule files for all SwiftIR targets
420+
echo "Copying Swift modules..."
421+
BUILD_DIR=".build/x86_64-unknown-linux-gnu/release"
422+
423+
# Copy all SwiftIR modules
424+
for module in SwiftIR SwiftIRCore SwiftIRTypes SwiftIRDialects SwiftIRBuilders SwiftIRXLA SwiftIRStableHLO SwiftIRRuntime; do
425+
if [ -d "$BUILD_DIR/Modules/${module}.swiftmodule" ]; then
426+
cp -r "$BUILD_DIR/Modules/${module}.swiftmodule" /opt/swiftir-deps/swift-modules/
427+
echo " ✅ Copied ${module}.swiftmodule"
428+
elif [ -f "$BUILD_DIR/${module}.swiftmodule" ]; then
429+
cp "$BUILD_DIR/${module}.swiftmodule" /opt/swiftir-deps/swift-modules/
430+
echo " ✅ Copied ${module}.swiftmodule"
431+
fi
432+
done
433+
434+
# Also copy any .swiftinterface files
435+
find "$BUILD_DIR" -name "*.swiftinterface" -exec cp {} /opt/swiftir-deps/swift-modules/ \; 2>/dev/null || true
436+
437+
# Copy built libraries
438+
echo "Copying built Swift libraries..."
439+
cp "$BUILD_DIR"/*.so /opt/swiftir-deps/lib/ 2>/dev/null || true
440+
cp "$BUILD_DIR"/*.a /opt/swiftir-deps/lib/ 2>/dev/null || true
441+
442+
echo ""
443+
echo "Swift modules packaged:"
444+
ls -la /opt/swiftir-deps/swift-modules/ 2>/dev/null || echo "No modules found"
445+
446+
# ============================================================
447+
# 8. Package and Upload Artifacts
397448
# ============================================================
398449

399450
- name: Create Dependency Archive
@@ -407,6 +458,10 @@ jobs:
407458
echo "Archive contents:"
408459
tar -tzf ~/SwiftIR-dependencies-ubuntu.tar.gz | head -50
409460
461+
echo ""
462+
echo "Swift modules in archive:"
463+
tar -tzf ~/SwiftIR-dependencies-ubuntu.tar.gz | grep swift-modules || echo "None"
464+
410465
- name: Upload Dependencies Artifact
411466
uses: actions/upload-artifact@v4
412467
with:
@@ -415,7 +470,7 @@ jobs:
415470
retention-days: 30
416471

417472
# ============================================================
418-
# 8. Summary Report
473+
# 9. Summary Report
419474
# ============================================================
420475

421476
- name: Generate Build Report
@@ -425,7 +480,7 @@ jobs:
425480
# SwiftIR Dependencies Build Report (Ubuntu)
426481
427482
## System Information
428-
- **Ubuntu Version:** 24.04
483+
- **Ubuntu Version:** 22.04 (GLIBC 2.35 - Colab compatible)
429484
- **Swift Version:** ${{ env.SWIFT_VERSION }}
430485
431486
## Dependencies Built

0 commit comments

Comments
 (0)