Skip to content

Commit e91f219

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

File tree

2 files changed

+83
-6
lines changed

2 files changed

+83
-6
lines changed

.github/workflows/build_test.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,52 @@ 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: Setup Windows
61+
run: ./scripts/setup-windows.ps1
62+
63+
- name: Set up JDK 11
64+
uses: actions/setup-java@v3
65+
with:
66+
distribution: 'temurin'
67+
java-version: '11'
68+
69+
- name: Build
70+
run: |
71+
./scripts/find_vs.ps1
72+
mkdir build
73+
cmake --version
74+
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TZ_LIB=ON
75+
ninja -C build
76+
77+
- name: Test
78+
run: ctest --test-dir build --output-on-failure --timeout 30

scripts/find_vs.ps1

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

0 commit comments

Comments
 (0)