|
| 1 | +name: Build ZIBO Keyboard Input Plugin |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build Plugin |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [windows-latest, macos-latest, ubuntu-latest] |
| 17 | + include: |
| 18 | + - os: windows-latest |
| 19 | + platform: windows |
| 20 | + artifact_name: win.xpl |
| 21 | + - os: macos-latest |
| 22 | + platform: mac |
| 23 | + artifact_name: mac.xpl |
| 24 | + - os: ubuntu-latest |
| 25 | + platform: linux |
| 26 | + artifact_name: lin.xpl |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Set up Python |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version: '3.x' |
| 35 | + |
| 36 | + - name: Install dependencies (Windows) |
| 37 | + if: runner.os == 'Windows' |
| 38 | + run: | |
| 39 | + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' |
| 40 | + shell: pwsh |
| 41 | + |
| 42 | + - name: Verify CMake installation (Windows) |
| 43 | + if: runner.os == 'Windows' |
| 44 | + run: | |
| 45 | + # Restart PowerShell session to ensure environment variables take effect |
| 46 | + $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User") |
| 47 | + cmake --version |
| 48 | + shell: pwsh |
| 49 | + |
| 50 | + - name: Install dependencies (macOS) |
| 51 | + if: runner.os == 'macOS' |
| 52 | + run: | |
| 53 | + brew install cmake |
| 54 | + |
| 55 | + - name: Install dependencies (Linux) |
| 56 | + if: runner.os == 'Linux' |
| 57 | + run: | |
| 58 | + sudo apt-get update |
| 59 | + sudo apt-get install -y cmake build-essential |
| 60 | + |
| 61 | + - name: Run configuration tests |
| 62 | + run: | |
| 63 | + python test_cross_platform.py |
| 64 | + |
| 65 | + - name: Build plugin (Windows) |
| 66 | + if: runner.os == 'Windows' |
| 67 | + run: | |
| 68 | + # Ensure environment variables are set correctly |
| 69 | + $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User") |
| 70 | + python build_all.py --platform ${{ matrix.platform }} |
| 71 | + shell: pwsh |
| 72 | + |
| 73 | + - name: Build plugin (Unix) |
| 74 | + if: runner.os != 'Windows' |
| 75 | + run: | |
| 76 | + python build_all.py --platform ${{ matrix.platform }} |
| 77 | + |
| 78 | + - name: Upload artifacts |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: zibo-keyboard-plugin-${{ matrix.platform }} |
| 82 | + path: build/${{ matrix.artifact_name }} |
| 83 | + retention-days: 30 |
| 84 | + |
| 85 | + release: |
| 86 | + name: Create Release Package |
| 87 | + needs: build |
| 88 | + runs-on: ubuntu-latest |
| 89 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Download all artifacts |
| 95 | + uses: actions/download-artifact@v4 |
| 96 | + with: |
| 97 | + path: artifacts/ |
| 98 | + |
| 99 | + - name: Create release package |
| 100 | + run: | |
| 101 | + mkdir -p release/ZIBOKeyboardInput |
| 102 | + cp artifacts/zibo-keyboard-plugin-windows/win.xpl release/ZIBOKeyboardInput/ |
| 103 | + cp artifacts/zibo-keyboard-plugin-mac/mac.xpl release/ZIBOKeyboardInput/ |
| 104 | + cp artifacts/zibo-keyboard-plugin-linux/lin.xpl release/ZIBOKeyboardInput/ |
| 105 | + |
| 106 | + # Create installation instructions file |
| 107 | + cat > release/ZIBOKeyboardInput/README.txt << 'EOF' |
| 108 | + ZIBO Keyboard Input Plugin Installation Guide |
| 109 | + =========================================== |
| 110 | + |
| 111 | + Choose the correct plugin file for your platform: |
| 112 | + - Windows: win.xpl |
| 113 | + - macOS: mac.xpl |
| 114 | + - Linux: lin.xpl |
| 115 | + |
| 116 | + Installation: |
| 117 | + 1. Copy the appropriate .xpl file to your X-Plane installation |
| 118 | + 2. Place it in: Resources/plugins/ZIBOKeyboardInput/ |
| 119 | + 3. Restart X-Plane |
| 120 | + |
| 121 | + Usage: |
| 122 | + - Load ZIBO 737 aircraft in X-Plane |
| 123 | + - Bind keys to these commands in Settings > Keyboard: |
| 124 | + * 3370Tech/ZIBO_Keyboard/Toggle_Keyboard_Input_Captain |
| 125 | + * 3370Tech/ZIBO_Keyboard/Toggle_Keyboard_Input_FO |
| 126 | + - Toggle keyboard input on/off as needed |
| 127 | + |
| 128 | + Build: $(date '+%Y-%m-%d %H:%M:%S') UTC |
| 129 | + Commit: ${{ github.sha }} |
| 130 | + EOF |
| 131 | + |
| 132 | + cd release |
| 133 | + tar -czf ZIBOKeyboardInput.tar.gz ZIBOKeyboardInput/ |
| 134 | + |
| 135 | + - name: Upload release package |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: zibo-keyboard-plugin-all-platforms |
| 139 | + path: release/ZIBOKeyboardInput.tar.gz |
| 140 | + retention-days: 90 |
0 commit comments