|
16 | 16 | # Define the jobs to run in the workflow |
17 | 17 | jobs: |
18 | 18 | 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 }} |
20 | 23 |
|
21 | 24 | steps: |
22 | 25 | - name: Checkout code |
|
29 | 32 |
|
30 | 33 | - name: Set up Swift |
31 | 34 | 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 |
34 | 53 |
|
35 | 54 | - name: Install dependencies |
36 | 55 | run: | |
|
41 | 60 | run: | |
42 | 61 | chmod +x build.sh |
43 | 62 | ./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 |
44 | 78 |
|
45 | 79 | - name: Run tests |
46 | 80 | run: | |
|
64 | 98 | git fetch origin |
65 | 99 | git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH |
66 | 100 | |
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 |
70 | 109 | |
71 | 110 | # Push to the target branch |
72 | 111 | git push origin $TARGET_BRANCH |
|
0 commit comments