-
Notifications
You must be signed in to change notification settings - Fork 989
168 lines (152 loc) · 6.99 KB
/
win-tests.yml
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
name: Windows Tests
on:
push:
branches:
- develop2
- release/*
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
testing:
strategy:
fail-fast: true
matrix:
python-version: ['3.9']
test-type: [unittests, integration, functional]
runs-on: windows-2022
name: Conan (${{ matrix.test-type }}) (${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v4
with:
path: C:\Users\runneradmin\AppData\Local\pip\cache
key: pip-packages-${{ runner.os }}-${{ hashFiles('conans/requirements*.txt') }}
restore-keys: |
pip-packages-${{ runner.os }}-
- name: Install Python requirements
run: |
pip install --upgrade pip
pip install -r conans/requirements.txt
pip install -r conans/requirements_server.txt
pip install -r conans/requirements_dev.txt
pip install meson
- name: Install Chocolatey packages
if: matrix.test-type == 'functional'
run: |
choco install pkgconfiglite --version 0.28
choco install ninja --version 1.10.2
choco install mingw
choco install cygwin
choco install cyg-get
cyg-get automake gcc-g++ make binutils --verbose
- name: Install Pacman extra packages
if: matrix.test-type == 'functional'
run: |
C:\msys64\usr\bin\pacman -Syuu --noconfirm
C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-toolchain --noconfirm
C:\msys64\usr\bin\pacman -S mingw-w64-i686-toolchain --noconfirm
C:\msys64\usr\bin\pacman -S base-devel gcc --noconfirm
C:\msys64\usr\bin\pacman -S autoconf-wrapper --noconfirm
C:\msys64\usr\bin\pacman -S automake --noconfirm
- name: Install VS 15 2017 Community edition
if: matrix.test-type == 'functional'
run: |
Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_community.exe" -OutFile "vs_installer.exe"
Start-Process -FilePath ".\vs_installer.exe" -ArgumentList `
"--quiet", "--wait", "--norestart", "--nocache", `
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", `
"--add", "Microsoft.VisualStudio.Component.Windows81SDK", `
"--add", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", `
"--add", "Microsoft.Component.MSBuild", `
"--add", "Microsoft.VisualStudio.Component.VC.CMake.Project", `
"--add", "Microsoft.VisualStudio.Workload.NativeDesktop", `
"--add", "Microsoft.VisualStudio.Component.VC.CoreBuildTools", `
"--add", "Microsoft.VisualStudio.Component.VC.ATLMFC" -Wait
- name: Cache CMake and Bazel installations
if: matrix.test-type == 'functional'
id: cache-tools
uses: actions/cache@v4
with:
path: |
C:\tools\cmake\3.15.7
C:\tools\cmake\3.19.7
C:\tools\cmake\3.23.5
C:\tools\bazel\6.3.2
C:\tools\bazel\7.1.2
key: ${{ runner.os }}-conan-tools-cache
- name: Build CMake old versions of CMake
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
$CMAKE_BUILD_VERSIONS = "3.15.7", "3.19.7"
foreach ($version in $CMAKE_BUILD_VERSIONS) {
Write-Host "Downloading CMake version $version for Windows..."
$destination = "C:\tools\cmake\$version"
if (-not (Test-Path $destination)) {
New-Item -Path $destination -ItemType Directory
}
$major_minor_version = ($version -split '\.')[0..1] -join '.'
$url = "https://cmake.org/files/v$major_minor_version/cmake-$version-win64-x64.zip"
$zipFile = "cmake-$version-windows-x86_64.zip"
Invoke-WebRequest -Uri $url -OutFile $zipFile
Expand-Archive -Path $zipFile -DestinationPath $destination -Force
Remove-Item $zipFile
}
- name: Install modern CMake versions
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
$CMAKE_BUILD_VERSIONS = "3.23.5"
foreach ($version in $CMAKE_BUILD_VERSIONS) {
$destination = "C:\tools\cmake\$version"
if (-not (Test-Path $destination)) {
New-Item -Path $destination -ItemType Directory
}
$major_minor_version = ($version -split '\.')[0..1] -join '.'
$url = "https://cmake.org/files/v$major_minor_version/cmake-$version-windows-x86_64.zip"
$zipFile = "cmake-$version-windows-x86_64.zip"
Invoke-WebRequest -Uri $url -OutFile $zipFile
Expand-Archive -Path $zipFile -DestinationPath $destination -Force
Remove-Item $zipFile
}
- name: Install Bazel versions
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
$BAZEL_BUILD_VERSIONS = "6.3.2", "7.1.2"
foreach ($version in $BAZEL_BUILD_VERSIONS) {
Write-Host "Downloading Bazel version $version for Windows..."
$destination = "C:\tools\bazel\$version"
if (-not (Test-Path $destination)) {
New-Item -Path $destination -ItemType Directory
}
$major_minor_version = ($version -split '\.')[0..1] -join '.'
$url = "https://github.com/bazelbuild/bazel/releases/download/$version/bazel-$version-windows-x86_64.zip"
$zipFile = "bazel-$version-windows-x86_64.zip"
Invoke-WebRequest -Uri $url -OutFile $zipFile
Expand-Archive -Path $zipFile -DestinationPath $destination -Force
Remove-Item $zipFile
}
- name: Run Tests
run: |
$shortGuid = [System.Guid]::NewGuid().ToString().Substring(0, 4)
$randomFolder = [System.IO.Path]::Combine("D:\\", "tmp_tests", $shortGuid)
New-Item -ItemType Directory -Force -Path $randomFolder
$env:CONAN_TEST_FOLDER = $randomFolder
$matrixTestType = "${{ matrix.test-type }}"
if ($matrixTestType -eq "unittests") {
pytest test/unittests --durations=20 --numprocesses=auto
} elseif ($matrixTestType -eq "integration") {
pytest test/integration --durations=20 --numprocesses=auto
} elseif ($matrixTestType -eq "functional") {
$env:Path = "C:\tools\cmake\3.15.7\cmake-3.15.7-win64-x64\bin;" + $env:Path
Remove-Item 'C:\Strawberry' -Recurse
pytest test/functional --durations=20 --numprocesses=auto
}