update README #1236
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-Windows | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| # Allows you to run this workflow manually from the Actions tab. | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled' | |
| required: false | |
| default: false | |
| env: | |
| VNOTE_VER: 4.3.0 | |
| jobs: | |
| build: | |
| name: ${{ matrix.config.name }} | |
| runs-on: windows-${{ matrix.config.vs_version }} | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - name: "Build on Win64 Qt 6" | |
| arch: win64_msvc2022_64 | |
| vs_version: 2022 | |
| vs_cmd: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" | |
| qt: 6.9.3 | |
| qt_modules: "qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat" | |
| qt_tools: tools_opensslv3_x64 | |
| qt_major: 6 | |
| suffix: "" | |
| - name: "Build on Win64 Qt 5.15" | |
| arch: win64_msvc2019_64 | |
| vs_version: 2022 | |
| vs_cmd: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" | |
| qt: 5.15.2 | |
| qt_modules: qtwebengine | |
| qt_tools: tools_opensslv3_x64 | |
| qt_major: 5 | |
| suffix: "-windows7" | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE. | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 1 | |
| submodules: recursive | |
| - name: Init Submodules | |
| shell: bash | |
| run: | | |
| auth_header="$(git config --local --get http.https://github.com/.extraheader)" | |
| git submodule sync --recursive | |
| git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 | |
| - name: Cache Qt | |
| id: cache-qt | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{runner.workspace}}/Qt | |
| key: ${{runner.os}}-${{matrix.config.arch}}-QtCache-${{matrix.config.qt}} | |
| - name: Setup MSVC v142 dev environment (Qt5 only) | |
| if: ${{ matrix.config.qt_major == 5 }} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| vsversion: "2022" | |
| toolset: "14.29" | |
| - name: Strip MinGW from PATH (Qt5 only) | |
| if: ${{ matrix.config.qt_major == 5 }} | |
| shell: pwsh | |
| run: | | |
| # windows-2022 ships with C:\mingw64\bin and C:\Strawberry on PATH. | |
| # CMake's compiler probe will pick gcc.exe before cl.exe and MinGW | |
| # silently wins. Strip these so cmake selects MSVC. | |
| $kept = $env:PATH -split ';' | Where-Object { | |
| $_ -and ($_ -notmatch '(?i)mingw') -and ($_ -notmatch '(?i)strawberry') | |
| } | |
| $newPath = ($kept -join ';') | |
| "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| Write-Host "Stripped MinGW/Strawberry from PATH." | |
| - name: Install Qt Official Build | |
| uses: jurplel/install-qt-action@v3 | |
| with: | |
| version: ${{matrix.config.qt}} | |
| target: desktop | |
| arch: ${{matrix.config.arch}} | |
| modules: ${{matrix.config.qt_modules}} | |
| tools: ${{matrix.config.qt_tools}} | |
| cache: 'true' | |
| - name: Create Build Dir | |
| shell: bash | |
| run: mkdir build | |
| working-directory: ${{runner.workspace}} | |
| - name: Clone OpenSSL on 5.15 | |
| shell: bash | |
| if: ${{ startsWith(matrix.config.qt, '5.15') }} | |
| run: | | |
| git clone https://github.com/tamlok/openssl-utils.git openssl-utils.git --depth=1 | |
| working-directory: ${{ runner.workspace }}/build | |
| # Enable tmate debugging of manually-triggered workflows if the input option was provided | |
| - name: Setup tmate session | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
| - name: Configure and Build Project | |
| shell: cmd | |
| env: | |
| QT_MAJOR: ${{ matrix.config.qt_major }} | |
| VS_CMD: ${{ matrix.config.vs_cmd }} | |
| RUNNER_WORKSPACE: ${{ runner.workspace }} | |
| # tests/CMakeLists.txt hard-requires Qt6 (find_package(Qt6 REQUIRED)), | |
| # so the Qt5 matrix entry MUST build packaging-only. Qt6 entry builds | |
| # tests so the Build-and-Run-Tests step below can ctest them. | |
| VNOTE_TESTS: ${{ matrix.config.qt_major == 6 && 'ON' || 'OFF' }} | |
| run: | | |
| cmake --version | |
| if "%QT_MAJOR%"=="6" call "%VS_CMD%" | |
| where cl || echo "cl.exe not on PATH" | |
| cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DQT_DEFAULT_MAJOR_VERSION=%QT_MAJOR% -DVNOTE_BUILD_TESTS=%VNOTE_TESTS% -DOPENSSL_EXTRA_LIB_DIR=%RUNNER_WORKSPACE%\build\openssl-utils.git\1.1.1j\Win_x64 %GITHUB_WORKSPACE% > cmake-configure.log 2>&1 || (type cmake-configure.log && exit /b 1) | |
| type cmake-configure.log | |
| cmake --build . | |
| cmake --build . --target=pack | |
| 7z x VNote*.zip -o* | |
| dir | |
| working-directory: ${{runner.workspace}}/build | |
| - name: Build and Run Tests (Qt6 only) | |
| # tests/CMakeLists.txt hard-requires Qt6 so this step is skipped on | |
| # the Qt5 matrix entry. The previous step already built tests when | |
| # VNOTE_BUILD_TESTS=ON, so ctest only needs to dispatch them. | |
| if: ${{ matrix.config.qt_major == 6 }} | |
| shell: cmd | |
| env: | |
| VS_CMD: ${{ matrix.config.vs_cmd }} | |
| run: | | |
| call "%VS_CMD%" | |
| ctest -C Release --output-on-failure | |
| working-directory: ${{runner.workspace}}/build | |
| - name: Re-run failed tests with extra-verbose output (debug aid) | |
| # On failure of the previous step, re-run only the failing tests with | |
| # --extra-verbose so Qt Test's PASS/FAIL lines + assertion details | |
| # land in the CI log. The QTEST_MAIN crash-handler workaround | |
| # (-nocrashhandler in CMakeLists) silences the default Qt Test stdout | |
| # path; --output-on-failure alone often shows nothing useful. This | |
| # step never gates the workflow (|| exit 0) - it's pure diagnostics. | |
| if: ${{ failure() && matrix.config.qt_major == 6 }} | |
| shell: cmd | |
| env: | |
| VS_CMD: ${{ matrix.config.vs_cmd }} | |
| run: | | |
| call "%VS_CMD%" | |
| ctest -C Release --rerun-failed --extra-verbose || exit 0 | |
| working-directory: ${{runner.workspace}}/build | |
| - name: Assert MSVC v142 + Qt 5.15.2 in use | |
| if: ${{ matrix.config.qt_major == 5 }} | |
| shell: bash | |
| working-directory: ${{ runner.workspace }}/build | |
| run: | | |
| grep -E "MSVC.*19\.29|Compiler.*19\.29" cmake-configure.log || (echo "v142 toolset NOT in use" && exit 1) | |
| grep -E "Found Qt5.*5\.15\.2|Qt5 .*5\.15\.2|5\.15\.2" cmake-configure.log || (echo "Qt 5.15.2 not found" && exit 1) | |
| echo "v142 + Qt 5.15.2 verified" | |
| - name: Rename on 5.15 | |
| shell: bash | |
| if: ${{ startsWith(matrix.config.qt, '5.15') }} | |
| working-directory: ${{ runner.workspace }}/build | |
| run: | | |
| mv VNote-${VNOTE_VER}-win64 VNote-${VNOTE_VER}-win64-windows7 || true | |
| mv VNote-${VNOTE_VER}-win64.zip VNote-${VNOTE_VER}-win64-windows7.zip || true | |
| - name: Verify Qt5 zip composition | |
| if: ${{ startsWith(matrix.config.qt, '5.15') }} | |
| shell: pwsh | |
| working-directory: ${{runner.workspace}}/build | |
| run: | | |
| $extracted = "VNote-${{env.VNOTE_VER}}-win64-windows7" | |
| Write-Host "PWD: $(Get-Location)" | |
| Write-Host "Build dir entries:" | |
| Get-ChildItem -Force | Select-Object Mode, Name | Format-Table | Out-String | Write-Host | |
| if (-not (Test-Path $extracted)) { | |
| Write-Host "Extracted dir '$extracted' not present; falling back to VNote-${{env.VNOTE_VER}}-win64" | |
| $extracted = "VNote-${{env.VNOTE_VER}}-win64" | |
| } | |
| if (-not (Test-Path $extracted)) { Write-Error "Neither extracted dir found"; exit 1 } | |
| Write-Host "Inspecting '$extracted':" | |
| Get-ChildItem -Force $extracted | Select-Object Mode, Name | Format-Table | Out-String | Write-Host | |
| $vnoteExe = Get-ChildItem -Path $extracted -Recurse -Filter vnote.exe -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if (-not $vnoteExe) { Write-Error "vnote.exe missing under $extracted"; exit 1 } | |
| Write-Host "vnote.exe -> $($vnoteExe.FullName)" | |
| foreach ($dll in @('Qt5Core.dll','Qt5WebEngineCore.dll','QtWebEngineProcess.exe')) { | |
| $hit = Get-ChildItem -Path $extracted -Recurse -Filter $dll -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if (-not $hit) { Write-Error "$dll missing under $extracted"; exit 1 } | |
| Write-Host "$dll -> $($hit.FullName)" | |
| } | |
| $qt6 = Get-ChildItem -Recurse $extracted -Filter "Qt6*.dll" -ErrorAction SilentlyContinue | |
| if ($qt6) { Write-Error "Qt6 DLLs leaked into Qt5 build: $($qt6 -join ', ')"; exit 1 } | |
| Write-Host "Qt5 zip composition OK" | |
| - name: Archive Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: VNote-${{env.VNOTE_VER}}-win64${{matrix.config.suffix}} | |
| path: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-win64${{matrix.config.suffix}} | |
| - name: Archive Installer | |
| if: ${{ !startsWith(matrix.config.qt, '5.15') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: VNote-${{env.VNOTE_VER}}-win64${{matrix.config.suffix}}.msi | |
| path: ${{runner.workspace}}/build/VNote*.msi | |
| - name: Update Continuous Build Release | |
| if: github.ref == 'refs/heads/master' | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # gh release commands run from build/ (not a git checkout), so gh's | |
| # git-based repo auto-detection fails ("fatal: not a git repository"). | |
| # GH_REPO makes every gh command target the repo without needing git. | |
| GH_REPO: ${{ github.repository }} | |
| SUFFIX: ${{matrix.config.suffix}} | |
| run: | | |
| set -e | |
| # Ensure the release + tag exist (idempotent; all jobs share GITHUB_SHA). | |
| gh release create continuous-build \ | |
| --target "$GITHUB_SHA" \ | |
| --title "Continuous Build" \ | |
| --prerelease \ | |
| --notes "Continuous build from master ($GITHUB_SHA)." || true | |
| gh api -X PATCH "repos/${GITHUB_REPOSITORY}/git/refs/tags/continuous-build" \ | |
| -F sha="$GITHUB_SHA" -F force=true || true | |
| STABLE="VNote-continuous-win64${SUFFIX}.zip" | |
| # Copy the built artifact to a stable, non-versioned name. | |
| cp "VNote-${VNOTE_VER}-win64${SUFFIX}.zip" "$STABLE" | |
| # Prune only this job's own asset family. The two regexes are mutually | |
| # exclusive: win64\.zip$ does NOT match ...win64-windows7.zip. | |
| if [ -n "$SUFFIX" ]; then | |
| PRUNE_RE='win64-windows7\.zip$' | |
| else | |
| PRUNE_RE='win64\.zip$' | |
| fi | |
| for asset in $(gh release view continuous-build \ | |
| --json assets --jq '.assets[].name' \ | |
| | grep -E "$PRUNE_RE"); do | |
| gh release delete-asset continuous-build "$asset" -y || true | |
| done | |
| # Upload the stable-named asset. | |
| gh release upload continuous-build "$STABLE" --clobber | |
| - name: Release | |
| if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, '[Release]') | |
| uses: ncipollo/release-action@v1.11.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # glob not supported; upload the packaged .zip (ncipollo cannot upload a | |
| # directory). Both matrix jobs target the same draft (allowUpdates:true): | |
| # Qt6 -> VNote-<ver>-win64.zip, Qt5.15 -> VNote-<ver>-win64-windows7.zip. | |
| artifacts: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-win64${{matrix.config.suffix}}.zip | |
| commit: master | |
| tag: v${{env.VNOTE_VER}} | |
| allowUpdates: true | |
| draft: true |