Update README.md #45
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: Build Windows Installer | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install Python dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| - name: Run backend tests | |
| run: python -m pytest backend/tests/ -v | |
| - name: Run frontend tests | |
| run: npm run test -- --run | |
| working-directory: frontend | |
| build: | |
| needs: test | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # --- Setup toolchains --- | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| src-tauri/target | |
| key: ${{ runner.os }}-cargo-v2-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo-v2- | |
| # --- Install dependencies --- | |
| - name: Install Python dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| - name: Install Tauri CLI | |
| uses: baptiste0928/cargo-install@v3 | |
| with: | |
| crate: tauri-cli | |
| # --- Step 1: Build frontend --- | |
| - name: Build frontend | |
| run: npm run build | |
| working-directory: frontend | |
| # --- Step 2: Build Python sidecar --- | |
| - name: Verify frontend built | |
| run: Test-Path backend\static\index.html | |
| shell: pwsh | |
| - name: Build sidecar | |
| run: | | |
| $root = $PWD.Path | |
| $triple = (rustc -vV | Select-String "host:").ToString().Split(" ")[1] | |
| $distPath = Join-Path (Join-Path $root "src-tauri") "binaries" | |
| $staticSrc = Join-Path (Join-Path $root "backend") "static" | |
| New-Item -ItemType Directory -Force -Path $distPath | Out-Null | |
| pyinstaller ` | |
| --onefile ` | |
| --name synced-server ` | |
| --add-data "$staticSrc;backend\static" ` | |
| --distpath $distPath ` | |
| --workpath (Join-Path (Join-Path $root "build") "pyinstaller") ` | |
| --specpath (Join-Path $root "build") ` | |
| --exclude-module numpy ` | |
| --exclude-module PIL ` | |
| --exclude-module Pillow ` | |
| --exclude-module tkinter ` | |
| --exclude-module _tkinter ` | |
| --exclude-module matplotlib ` | |
| --exclude-module scipy ` | |
| --exclude-module pandas ` | |
| --exclude-module pytest ` | |
| --exclude-module pygments ` | |
| --exclude-module rich ` | |
| --exclude-module chardet ` | |
| backend\sidecar_entry.py | |
| $exe = Join-Path $distPath "synced-server.exe" | |
| $target = Join-Path $distPath "synced-server-$triple.exe" | |
| Move-Item -Force $exe $target | |
| Write-Host "Sidecar built: $target" | |
| shell: pwsh | |
| # --- Step 3: Build Tauri app --- | |
| - name: Build Tauri installer | |
| run: cargo tauri build | |
| working-directory: src-tauri | |
| # --- Upload artifacts --- | |
| - name: Upload MSI installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synced-windows-installer | |
| path: src-tauri/target/release/bundle/msi/*.msi | |
| - name: Upload portable exe | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: synced-windows-exe | |
| path: src-tauri/target/release/Synced.exe |