CI: verify Windows /utf-8 fix simulates CP936 end-to-end #103
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| analyze: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - run: flutter pub get | |
| - run: flutter analyze | |
| test-dart: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - run: flutter pub get | |
| - run: flutter test | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| clang cmake ninja-build pkg-config \ | |
| libgtk-3-dev \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| gstreamer1.0-plugins-good \ | |
| libmpv-dev | |
| - run: cd example && flutter build linux | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - run: cd example && flutter build macos | |
| test-macos-native: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - run: cd example && flutter build macos --debug | |
| - name: Run XCTests | |
| run: | | |
| cd example/macos | |
| xcodebuild test \ | |
| -workspace Runner.xcworkspace \ | |
| -scheme Runner \ | |
| -configuration Debug \ | |
| -quiet | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Verify /utf-8 is set for MSVC in windows/CMakeLists.txt | |
| shell: bash | |
| run: | | |
| grep -q '/utf-8' windows/CMakeLists.txt \ | |
| || { echo "::error::windows/CMakeLists.txt is missing /utf-8 — see chinese-pc-compat.md"; exit 1; } | |
| - name: Verify ci/cp936_repro.cpp covers every non-ASCII char in windows/ | |
| shell: bash | |
| run: python ci/check_unicode_inventory.py | |
| - name: Verify ci/cp936_repro.cpp has no UTF-8 BOM | |
| shell: bash | |
| run: | | |
| bom=$(head -c 3 ci/cp936_repro.cpp | od -An -tx1 | tr -d ' \n') | |
| if [ "$bom" = "efbbbf" ]; then | |
| echo "::error::ci/cp936_repro.cpp must not have a BOM (MSVC would auto-detect UTF-8 and bypass /source-charset:.936)" | |
| exit 1 | |
| fi | |
| echo "OK: no BOM" | |
| - name: CP936 simulation without /utf-8 must fail with C4819/C2220 | |
| shell: cmd | |
| run: | | |
| cl /c /WX /source-charset:.936 /execution-charset:.936 /nologo ci\cp936_repro.cpp > cl.log 2>&1 | |
| set CL_EXIT=%errorlevel% | |
| type cl.log | |
| if %CL_EXIT% equ 0 ( | |
| echo ::error::Expected C4819/C2220 but compile succeeded — CP936 simulation is not triggering the bug | |
| exit /b 1 | |
| ) | |
| findstr /c:"C4819" cl.log >nul | |
| if errorlevel 1 ( | |
| echo ::error::cl.exe failed but did not emit C4819 — test is not reproducing the real bug | |
| exit /b 1 | |
| ) | |
| findstr /c:"C2220" cl.log >nul | |
| if errorlevel 1 ( | |
| echo ::error::cl.exe failed but did not emit C2220 — /WX promotion is not working as expected | |
| exit /b 1 | |
| ) | |
| echo OK: CP936 simulation reproduced C4819/C2220 as expected | |
| exit /b 0 | |
| - name: CP936 simulation with /utf-8 must succeed (proves the fix) | |
| shell: cmd | |
| run: cl /c /WX /source-charset:.936 /execution-charset:.936 /utf-8 /nologo ci\cp936_repro.cpp | |
| - name: Build the example (generates the plugin vcxproj) | |
| run: cd example && flutter build windows | |
| - name: Verify /utf-8 is threaded into the generated plugin vcxproj | |
| shell: bash | |
| run: | | |
| vcxproj=$(find example/build/windows -name 'camera_desktop_plugin.vcxproj' | head -n1) | |
| if [ -z "$vcxproj" ]; then | |
| echo "::error::camera_desktop_plugin.vcxproj not found under example/build/windows" | |
| find example/build/windows -name '*.vcxproj' || true | |
| exit 1 | |
| fi | |
| echo "Inspecting: $vcxproj" | |
| if ! grep -q '/utf-8' "$vcxproj"; then | |
| echo "::error::/utf-8 missing from $vcxproj — CMake did not thread the flag through" | |
| echo "--- vcxproj contents ---" | |
| cat "$vcxproj" | |
| exit 1 | |
| fi | |
| echo "OK: /utf-8 present in $vcxproj" |