Fix HealthKit dependency: replace HKUnit with LoopUnit #67
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Workflow | |
| # Trigger on PR events and direct pushes to main (but not PR merges) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feature/windows-linux-compability | |
| pull_request: | |
| branches: | |
| - main | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| # Define the jobs to run in the workflow | |
| jobs: | |
| build-and-test: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' # Specify your required Python version | |
| - name: Set up Swift | |
| run: | | |
| if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer | |
| sudo xcodebuild -runFirstLaunch | |
| else | |
| # Install Swift for Linux with debugging | |
| echo "Installing Swift for Linux..." | |
| 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 | |
| tar xzf swift-6.0.3-RELEASE-ubuntu24.04.tar.gz | |
| sudo mv swift-6.0.3-RELEASE-ubuntu24.04 /usr/local/swift | |
| echo "/usr/local/swift/usr/bin" >> $GITHUB_PATH | |
| sudo apt update | |
| sudo apt install -y build-essential libc6-dev | |
| # Verify Swift installation | |
| echo "Verifying Swift installation:" | |
| ls -la /usr/local/swift/usr/bin/ | |
| /usr/local/swift/usr/bin/swift --version | |
| fi | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Run build script | |
| run: | | |
| chmod +x build.sh | |
| ./build.sh | |
| # Debug: Check what files were actually generated | |
| echo "Files in .build/release/:" | |
| ls -la .build/release/ || echo "No .build/release directory" | |
| echo "Files in loop_to_python_api/dlibs/:" | |
| ls -la loop_to_python_api/dlibs/ || echo "No dlibs directory" | |
| if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| echo "macOS library file:" | |
| ls -la loop_to_python_api/dlibs/macos/ || echo "No macOS dlibs" | |
| else | |
| echo "Linux library file:" | |
| ls -la loop_to_python_api/dlibs/linux/ || echo "No Linux dlibs" | |
| fi | |
| - name: Run tests | |
| run: | | |
| pytest | |
| - name: Commit and push the generated .dylib file | |
| # Skip if this is a PR merge (indicated by commit message containing "Merge pull request") | |
| if: github.event_name == 'pull_request' || !contains(github.event.head_commit.message, 'Merge pull request') | |
| run: | | |
| git config --local user.name "GitHub Action" | |
| git config --local user.email "action@github.com" | |
| # Determine target branch | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| TARGET_BRANCH="${{ github.event.pull_request.head.ref }}" | |
| else | |
| TARGET_BRANCH="${{ github.ref_name }}" | |
| fi | |
| # Fetch and checkout the target branch | |
| git fetch origin | |
| git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH | |
| # Add and commit the library file for the appropriate platform | |
| if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| git add ./loop_to_python_api/dlibs/macos/libLoopAlgorithmToPython.dylib | |
| git commit -m "Add generated libLoopAlgorithmToPython.dylib" || echo "No changes to commit" | |
| else | |
| git add ./loop_to_python_api/dlibs/linux/libLoopAlgorithmToPython.so | |
| git commit -m "Add generated libLoopAlgorithmToPython.so" || echo "No changes to commit" | |
| fi | |
| # Push to the target branch | |
| git push origin $TARGET_BRANCH | |