-
Notifications
You must be signed in to change notification settings - Fork 180
420 lines (393 loc) · 13.9 KB
/
native-windows.yml
File metadata and controls
420 lines (393 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Native Libraries (Windows)
on:
pull_request:
branches:
- main
paths:
- "c/**"
- "ci/**"
- "glib/**"
- "go/**"
- "python/**"
- "ruby/**"
- ".github/workflows/native-windows.yml"
push:
branches-ignore:
- 'dependabot/**'
paths:
- "c/**"
- "ci/**"
- "glib/**"
- "go/**"
- "python/**"
- "ruby/**"
- ".github/workflows/native-windows.yml"
workflow_call:
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}-windows
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: pwsh
jobs:
# ------------------------------------------------------------
# Common build (builds libraries used in GLib, Python, Ruby)
# ------------------------------------------------------------
drivers-build-conda:
name: "Common C/C++ Libraries (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v5
env:
# Increment this to reset cache manually
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }}
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: true
- name: Install Dependencies
run: |
mamba install -c conda-forge `
--file ci\conda_env_cpp.txt
# Force bundled gtest
mamba uninstall gtest
- name: Build and Install (No ASan)
env:
BUILD_ALL: "1"
# TODO(apache/arrow-adbc#634)
BUILD_DRIVER_BIGQUERY: "0"
BUILD_DRIVER_FLIGHTSQL: "0"
BUILD_DRIVER_SNOWFLAKE: "0"
BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1"
run: |
.\ci\scripts\cpp_build.ps1 $pwd ${{ github.workspace }}\build
- uses: actions/upload-artifact@v7
with:
name: driver-manager-${{ matrix.os }}
retention-days: 3
path: |
${{ github.workspace }}/build
# ------------------------------------------------------------
# C/C++ build (builds and tests)
# ------------------------------------------------------------
drivers-test-conda:
name: "C/C++ (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v5
env:
# Increment this to reset cache manually
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }}
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: true
- name: Install Dependencies
run: |
mamba install -c conda-forge `
--file ci\conda_env_cpp.txt
# Force bundled gtest
mamba uninstall gtest
- name: Build Driver Manager
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Build Driver PostgreSQL
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Build Driver SQLite
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Test Driver Manager
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1"
run: .\ci\scripts\cpp_test.ps1 $pwd\build
- name: Test Driver SQLite
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_test.ps1 $pwd\build
# ------------------------------------------------------------
# Go build
# ------------------------------------------------------------
go-conda:
name: "Go (CGO) (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
strategy:
matrix:
os: ["windows-latest"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Get required Go version
shell: bash
run: |
(. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v5
env:
# Increment this to reset cache manually
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }}
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: true
- name: Install Dependencies
run: |
mamba install -c conda-forge `
--file ci\conda_env_cpp.txt
- uses: actions/setup-go@v6
with:
go-version: "${{ env.GO_VERSION }}"
check-latest: true
cache: true
cache-dependency-path: go/adbc/go.sum
- uses: actions/download-artifact@v8
with:
name: driver-manager-${{ matrix.os }}
path: ${{ github.workspace }}/build
- name: Go Build
env:
CGO_ENABLED: "1"
run: |
$env:PATH="${env:RUNNER_TOOL_CACHE}\go\${env:GO_VERSION}\x64\bin;${env:PATH}"
.\ci\scripts\go_build.ps1 $pwd $pwd\build
# TODO(apache/arrow#358): enable these tests on Windows
# - name: Go Test
# env:
# CGO_ENABLED: "1"
# run: |
# $env:PATH="${env:RUNNER_TOOL_CACHE}\go\${env:GO_VERSION}\x64\bin;${env:PATH}"
# .\ci\scripts\go_test.ps1 $pwd $pwd\build
# ------------------------------------------------------------
# Python build
# ------------------------------------------------------------
python-conda:
name: "Python ${{ matrix.python }} (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
strategy:
matrix:
os: ["windows-latest"]
python: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set Winlibs version
id: winlibs-version
shell: pwsh
run: |
$winlibs_asset_name = "winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-13.0.0-r4.7z"
echo "winlibs_asset_name=$winlibs_asset_name" >> $env:GITHUB_OUTPUT
- name: Cache Winlibs
id: cache-winlibs
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/winlibs
key: winlibs-${{ steps.winlibs-version.outputs.winlibs_asset_name }}
- name: Download and setup Winlibs
if: steps.cache-winlibs.outputs.cache-hit != 'true'
shell: pwsh
run: |
$base_url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/15.2.0posix-13.0.0-ucrt-r4/"
$asset_name = "${{ steps.winlibs-version.outputs.winlibs_asset_name }}"
$hash_expected = "148175f2ba3c4ab0bfd93116b75f7ff172e9e0d06ca8680c8a98c375ec45abb5"
$url = $base_url + $asset_name
Write-Host "Downloading $asset_name..."
Invoke-WebRequest -Uri $url -OutFile $asset_name -UseBasicParsing
Write-Host "Verifying hash..."
$hash_actual = (Get-FileHash -Path $asset_name -Algorithm SHA256).Hash.ToLower()
if ($hash_actual -ne $hash_expected) {
throw "SHA256 mismatch! Expected: $hash_expected, Got: $hash_actual"
}
Write-Host "Extracting..."
7z x $asset_name -o"${{ runner.temp }}/winlibs" -y
Remove-Item $asset_name -Force
- name: Add Winlibs to PATH
shell: pwsh
run: |
$winlibs_bin = Join-Path "${{ runner.temp }}" "winlibs\mingw64\bin"
$env:PATH="$winlibs_bin;${env:PATH}"
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v5
env:
# Increment this to reset cache manually
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }}
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: true
- name: Install Dependencies
run: |
mamba install -c conda-forge `
python=${{ matrix.python }} `
--file ci\conda_env_cpp.txt `
--file ci\conda_env_python.txt
- uses: actions/download-artifact@v8
with:
name: driver-manager-${{ matrix.os }}
path: ${{ github.workspace }}/build
- name: Build Python Driver Manager
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
run: .\ci\scripts\python_build.ps1 $pwd $pwd\build
- name: Build Python Driver PostgreSQL
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
run: .\ci\scripts\python_build.ps1 $pwd $pwd\build
- name: Build Python Driver SQLite
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\python_build.ps1 $pwd $pwd\build
- name: Test Python Driver Manager
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
run: .\ci\scripts\python_test.ps1 $pwd $pwd\build
- name: Test Python Driver PostgreSQL
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
run: .\ci\scripts\python_test.ps1 $pwd $pwd\build
- name: Test Python Driver SQLite
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\python_test.ps1 $pwd $pwd\build
# ------------------------------------------------------------
# MSVC/vcpkg build (no Conda)
# ------------------------------------------------------------
drivers-vcpkg:
name: "C/C++ (vcpkg/${{ matrix.os }}/${{ matrix.config }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest"]
arch: ["x64"]
config: ["debug", "release"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
- name: Setup MSYS2 tools
run: |
# msys64 is pre-installed on windows but not added to path
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin\;C:\msys64\ucrt64\bin;$env:PATH"
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
# Needed for gendef tool in GoUtils.cmake
pacman --noconfirm -S mingw-w64-x86_64-tools
# TODO(https://github.com/apache/arrow-adbc/issues/3825)
- name: Clone vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0
.\bootstrap-vcpkg.bat
- name: Install vcpkg dependencies
working-directory: c
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: |
${{ github.workspace }}/vcpkg/vcpkg.exe install libpq sqlite3 --triplet ${{ matrix.arch }}-windows
- name: Build and Install (No ASan)
env:
CMAKE_BUILD_TYPE: ${{ matrix.config }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: |
cmake .\c\ --preset windows-${{ matrix.config }} -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build .\build\${{ matrix.config }} --target install --config ${{ matrix.config }} --parallel
- name: Test
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_test.ps1 $pwd\build\${{ matrix.config }} $pwd\local\${{ matrix.config }}