Skip to content

Commit 9b35922

Browse files
committed
Fix CI workflow with simple Linux support and debugging
- Replaced complex build-all-platforms.yml with simple matrix approach - Added macOS + Linux matrix to existing ci.yml workflow - Added extensive debugging to identify Linux Swift build issues - Updated commit logic to handle both .dylib and .so files - Enhanced build.sh with verbose logging and file verification - Uses dlibs/ structure for proper organization This approach builds on the working macOS CI instead of starting from scratch.
1 parent 496d0b7 commit 9b35922

3 files changed

Lines changed: 50 additions & 147 deletions

File tree

.github/workflows/build-all-platforms.yml

Lines changed: 0 additions & 140 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ on:
1616
# Define the jobs to run in the workflow
1717
jobs:
1818
build-and-test:
19-
runs-on: macos-latest # Use macOS for Swift and iOS-specific dependencies
19+
strategy:
20+
matrix:
21+
os: [macos-latest, ubuntu-latest]
22+
runs-on: ${{ matrix.os }}
2023

2124
steps:
2225
- name: Checkout code
@@ -29,8 +32,24 @@ jobs:
2932

3033
- name: Set up Swift
3134
run: |
32-
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
33-
sudo xcodebuild -runFirstLaunch
35+
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
36+
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
37+
sudo xcodebuild -runFirstLaunch
38+
else
39+
# Install Swift for Linux with debugging
40+
echo "Installing Swift for Linux..."
41+
wget https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu24.04.tar.gz
42+
tar xzf swift-6.0.3-RELEASE-ubuntu24.04.tar.gz
43+
sudo mv swift-6.0.3-RELEASE-ubuntu24.04 /usr/local/swift
44+
echo "/usr/local/swift/usr/bin" >> $GITHUB_PATH
45+
sudo apt update
46+
sudo apt install -y build-essential libc6-dev
47+
48+
# Verify Swift installation
49+
echo "Verifying Swift installation:"
50+
ls -la /usr/local/swift/usr/bin/
51+
/usr/local/swift/usr/bin/swift --version
52+
fi
3453
3554
- name: Install dependencies
3655
run: |
@@ -41,6 +60,21 @@ jobs:
4160
run: |
4261
chmod +x build.sh
4362
./build.sh
63+
64+
# Debug: Check what files were actually generated
65+
echo "Files in .build/release/:"
66+
ls -la .build/release/ || echo "No .build/release directory"
67+
68+
echo "Files in loop_to_python_api/dlibs/:"
69+
ls -la loop_to_python_api/dlibs/ || echo "No dlibs directory"
70+
71+
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
72+
echo "macOS library file:"
73+
ls -la loop_to_python_api/dlibs/macos/ || echo "No macOS dlibs"
74+
else
75+
echo "Linux library file:"
76+
ls -la loop_to_python_api/dlibs/linux/ || echo "No Linux dlibs"
77+
fi
4478
4579
- name: Run tests
4680
run: |
@@ -64,9 +98,14 @@ jobs:
6498
git fetch origin
6599
git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH
66100
67-
# Add and commit the .dylib file to new dlibs structure
68-
git add ./loop_to_python_api/dlibs/macos/libLoopAlgorithmToPython.dylib
69-
git commit -m "Add generated libLoopAlgorithmToPython.dylib" || echo "No changes to commit"
101+
# Add and commit the library file for the appropriate platform
102+
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
103+
git add ./loop_to_python_api/dlibs/macos/libLoopAlgorithmToPython.dylib
104+
git commit -m "Add generated libLoopAlgorithmToPython.dylib" || echo "No changes to commit"
105+
else
106+
git add ./loop_to_python_api/dlibs/linux/libLoopAlgorithmToPython.so
107+
git commit -m "Add generated libLoopAlgorithmToPython.so" || echo "No changes to commit"
108+
fi
70109
71110
# Push to the target branch
72111
git push origin $TARGET_BRANCH

build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ echo "Building dynamic c library from Swift code..."
55
# Run the Swift package commands to build the dynamic c library
66
swift package clean
77
swift package update
8-
swift build --configuration release
8+
echo "Building Swift package..."
9+
swift build --configuration release --verbose
10+
11+
echo "Build completed. Files in .build/release/:"
12+
ls -la .build/release/ 2>/dev/null || echo "No .build/release directory found"
913

1014
# Detect the operating system and set the library paths
1115
if [[ "$OSTYPE" == "darwin"* ]]; then

0 commit comments

Comments
 (0)