|
| 1 | +name: Windows headless build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - win-build |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Windows ${{ matrix.arch }} |
| 16 | + runs-on: ${{ matrix.runner }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - arch: x86_64 |
| 22 | + runner: windows-latest |
| 23 | + vcpkg-triplet: x64-windows |
| 24 | + python-architecture: x64 |
| 25 | + - arch: arm64 |
| 26 | + runner: windows-11-arm |
| 27 | + vcpkg-triplet: arm64-windows |
| 28 | + python-architecture: arm64 |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Check out source |
| 32 | + uses: actions/checkout@v6 |
| 33 | + |
| 34 | + - name: Set up Python |
| 35 | + uses: actions/setup-python@v6 |
| 36 | + with: |
| 37 | + python-version: '3.x' |
| 38 | + architecture: ${{ matrix.python-architecture }} |
| 39 | + check-latest: true |
| 40 | + |
| 41 | + - name: Install Meson and Ninja |
| 42 | + shell: pwsh |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + python -m pip install meson ninja |
| 46 | +
|
| 47 | + - name: Prepare vcpkg |
| 48 | + shell: pwsh |
| 49 | + run: | |
| 50 | + if (-not $env:VCPKG_ROOT) { |
| 51 | + $env:VCPKG_ROOT = Join-Path $env:RUNNER_TEMP "vcpkg" |
| 52 | + git clone https://github.com/microsoft/vcpkg.git $env:VCPKG_ROOT |
| 53 | + } |
| 54 | +
|
| 55 | + if (-not (Test-Path (Join-Path $env:VCPKG_ROOT "vcpkg.exe"))) { |
| 56 | + & (Join-Path $env:VCPKG_ROOT "bootstrap-vcpkg.bat") -disableMetrics |
| 57 | + } |
| 58 | +
|
| 59 | + "VCPKG_ROOT=$env:VCPKG_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 60 | +
|
| 61 | + - name: Install native dependencies |
| 62 | + shell: pwsh |
| 63 | + run: | |
| 64 | + $triplet = "${{ matrix.vcpkg-triplet }}" |
| 65 | + & "$env:VCPKG_ROOT\vcpkg.exe" install --triplet $triplet ` |
| 66 | + pkgconf ` |
| 67 | + libxml2 ` |
| 68 | + libxslt ` |
| 69 | + zlib ` |
| 70 | + libmagic ` |
| 71 | + xapian-core ` |
| 72 | + libiconv |
| 73 | +
|
| 74 | + $installed = Join-Path $env:VCPKG_ROOT "installed\$triplet" |
| 75 | + $pkgconf = Join-Path $installed "tools\pkgconf\pkgconf.exe" |
| 76 | +
|
| 77 | + (Join-Path $installed "bin") | Out-File -FilePath $env:GITHUB_PATH -Append |
| 78 | + "CC=cl" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 79 | + "CXX=cl" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 80 | + "INCLUDE=$(Join-Path $installed 'include');$env:INCLUDE" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 81 | + "LIB=$(Join-Path $installed 'lib');$env:LIB" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 82 | + "PKG_CONFIG=$pkgconf" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 83 | + "PKG_CONFIG_PATH=$(Join-Path $installed 'lib\pkgconfig');$(Join-Path $installed 'share\pkgconfig')" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 84 | +
|
| 85 | + - name: Configure headless build |
| 86 | + shell: pwsh |
| 87 | + working-directory: src |
| 88 | + run: | |
| 89 | + meson setup build-headless ` |
| 90 | + --backend ninja ` |
| 91 | + --buildtype release ` |
| 92 | + --prefix C:/recoll-headless ` |
| 93 | + -Dqtgui=false ` |
| 94 | + -Drecollq=true ` |
| 95 | + -Dpython-module=true ` |
| 96 | + -Dpython-chm=false ` |
| 97 | + -Dpython-aspell=false ` |
| 98 | + -Daspell=false ` |
| 99 | + -Dsemantic=false ` |
| 100 | + -Dx11mon=false ` |
| 101 | + -Dsystemd=false ` |
| 102 | + -Dinotify=false ` |
| 103 | + -Dfam=false ` |
| 104 | + -Dfsevents=false ` |
| 105 | + -Dlibmagic=true ` |
| 106 | + -Didxthreads=false |
| 107 | +
|
| 108 | + - name: Build headless binaries |
| 109 | + shell: pwsh |
| 110 | + working-directory: src |
| 111 | + run: meson compile -C build-headless |
| 112 | + |
| 113 | + - name: Package binaries |
| 114 | + shell: pwsh |
| 115 | + working-directory: src |
| 116 | + run: | |
| 117 | + $triplet = "${{ matrix.vcpkg-triplet }}" |
| 118 | + $dist = Join-Path $PWD "dist\recoll-headless-${{ matrix.arch }}" |
| 119 | + $pythonPackage = Join-Path $dist "python\recoll" |
| 120 | + New-Item -ItemType Directory -Force $dist, $pythonPackage | Out-Null |
| 121 | +
|
| 122 | + Copy-Item "build-headless\recollq.exe" $dist |
| 123 | + Copy-Item "build-headless\recollindex.exe" $dist |
| 124 | + Copy-Item "build-headless\python\recoll\_recoll*.pyd" $pythonPackage |
| 125 | + Copy-Item "python\recoll\recoll\*.py" $pythonPackage |
| 126 | +
|
| 127 | + $vcpkgBin = Join-Path $env:VCPKG_ROOT "installed\$triplet\bin" |
| 128 | + if (Test-Path $vcpkgBin) { |
| 129 | + Copy-Item "$vcpkgBin\*.dll" $dist -ErrorAction SilentlyContinue |
| 130 | + Copy-Item "$vcpkgBin\*.dll" $pythonPackage -ErrorAction SilentlyContinue |
| 131 | + } |
| 132 | +
|
| 133 | + @" |
| 134 | + Recoll native Windows headless build for ${{ matrix.arch }}. |
| 135 | +
|
| 136 | + Command-line tools: |
| 137 | + recollq.exe |
| 138 | + recollindex.exe |
| 139 | +
|
| 140 | + Python package: |
| 141 | + Add this artifact's python directory to PYTHONPATH. |
| 142 | + The packaged DLLs must remain beside the executables and _recoll*.pyd. |
| 143 | + "@ | Set-Content -Path (Join-Path $dist "README-windows-build.txt") |
| 144 | +
|
| 145 | + - name: Smoke test packaged binaries |
| 146 | + shell: pwsh |
| 147 | + working-directory: src |
| 148 | + run: | |
| 149 | + $dist = Resolve-Path "dist\recoll-headless-${{ matrix.arch }}" |
| 150 | + & "$dist\recollindex.exe" -h |
| 151 | + & "$dist\recollq.exe" -h |
| 152 | + if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne 1) { |
| 153 | + exit $LASTEXITCODE |
| 154 | + } |
| 155 | +
|
| 156 | + $pythonRoot = Join-Path $dist "python" |
| 157 | + python -c "import os, sys; os.add_dll_directory(r'$dist'); sys.path.insert(0, r'$pythonRoot'); import recoll.recoll; print('python module ok')" |
| 158 | +
|
| 159 | + - name: Upload artifact |
| 160 | + uses: actions/upload-artifact@v6 |
| 161 | + with: |
| 162 | + name: recoll-headless-windows-${{ matrix.arch }} |
| 163 | + path: src/dist/recoll-headless-${{ matrix.arch }} |
| 164 | + if-no-files-found: error |
0 commit comments