Skip to content

Commit 216c6f4

Browse files
committed
Separate windows and ubuntu
1 parent 5d05a2b commit 216c6f4

File tree

2 files changed

+81
-6
lines changed

2 files changed

+81
-6
lines changed

.github/workflows/build_test.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,49 @@ jobs:
2727
run: git diff --exit-code
2828
- name: Checking code style
2929
run: ./scripts/run-clang-tidy.sh
30-
build:
30+
31+
ubuntu-build:
3132
runs-on: ubuntu-latest
3233

3334
steps:
3435
- uses: actions/checkout@v3
3536
with:
3637
submodules: recursive
38+
3739
- name: Setup Ubuntu
40+
run: ./scripts/setup-ubuntu.sh
41+
42+
- name: Build
3843
run: |
39-
./scripts/setup-ubuntu.sh
4044
mkdir build
41-
- name: Run cmake
42-
run: |
4345
cmake --version
4446
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TZ_LIB=ON
45-
- name: Build
46-
run: ninja -C build
47+
ninja -C build
48+
4749
- name: Test
4850
run: ctest --test-dir build --output-on-failure --timeout 30
4951

52+
windows-build:
53+
runs-on: windows-latest
54+
55+
steps:
56+
- uses: actions/checkout@v3
57+
with:
58+
submodules: recursive
59+
60+
- name: Set up JDK 11
61+
uses: actions/setup-java@v3
62+
with:
63+
distribution: 'temurin'
64+
java-version: '11'
65+
66+
- name: Build
67+
run: |
68+
./scripts/find_vs.ps1
69+
mkdir build
70+
cmake --version
71+
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TZ_LIB=ON
72+
ninja -C build
73+
74+
- name: Test
75+
run: ctest --test-dir build --output-on-failure --timeout 30

scripts/find_vs.ps1

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Find and enter a Visual Studio development environment.
3+
# Required to use Ninja instead of msbuild on our build agents.
4+
function Enter-VsDevEnv {
5+
[CmdletBinding()]
6+
param(
7+
[Parameter()]
8+
[switch]$Prerelease,
9+
[Parameter()]
10+
[string]$architecture = "x64"
11+
)
12+
13+
$ErrorActionPreference = 'Stop'
14+
15+
if ($null -eq (Get-InstalledModule -name 'VSSetup' -ErrorAction SilentlyContinue)) {
16+
Install-Module -Name 'VSSetup' -Scope CurrentUser -SkipPublisherCheck -Force
17+
}
18+
Import-Module -Name 'VSSetup'
19+
20+
Write-Verbose 'Searching for VC++ instances'
21+
$vsinfo = `
22+
Get-VSSetupInstance -All -Prerelease:$Prerelease `
23+
| Select-VSSetupInstance `
24+
-Latest -Product * `
25+
-Require 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
26+
27+
$vspath = $vsinfo.InstallationPath
28+
29+
switch ($env:PROCESSOR_ARCHITECTURE) {
30+
"amd64" { $hostarch = "x64" }
31+
"x86" { $hostarch = "x86" }
32+
"arm64" { $hostarch = "arm64" }
33+
default { throw "Unknown architecture: $switch" }
34+
}
35+
36+
$devShellModule = "$vspath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
37+
38+
Import-Module -Global -Name $devShellModule
39+
40+
Write-Verbose 'Setting up environment variables'
41+
Enter-VsDevShell -VsInstanceId $vsinfo.InstanceId -SkipAutomaticLocation `
42+
-devCmdArguments "-arch=$architecture -host_arch=$hostarch"
43+
44+
Set-Item -Force -path "Env:\Platform" -Value $architecture
45+
46+
remove-Module Microsoft.VisualStudio.DevShell, VSSetup
47+
}
48+
49+
Enter-VsDevEnv

0 commit comments

Comments
 (0)