Debian Codegraph @

.github/workflows/windows.yml

raw
1 name: windows
2
3 on:
4 push:
5 branches:
6 - 'master'
7 # Release branches
8 - '1.*'
9 paths:
10 - 'mesonbuild/**'
11 - 'test cases/**'
12 - 'unittests/**'
13 - '.github/workflows/*.yml'
14 - 'ci/run.ps1'
15 - 'run_project_tests.py'
16 - 'run_tests.py'
17 - 'run_unittests.py'
18 pull_request:
19 paths:
20 - 'mesonbuild/**'
21 - 'test cases/**'
22 - 'unittests/**'
23 - '.github/workflows/*.yml'
24 - 'ci/run.ps1'
25 - 'run_project_tests.py'
26 - 'run_tests.py'
27 - 'run_unittests.py'
28
29 concurrency:
30 group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
31 cancel-in-progress: true
32
33 jobs:
34 vs2022:
35 runs-on: windows-2022
36 timeout-minutes: 120
37 name: ${{ matrix.name }}
38
39 strategy:
40 fail-fast: false
41 matrix:
42 include:
43 - name: vc2022x64vs
44 arch: x64
45 compiler: msvc2022
46 backend: vs2022
47 # mysteriously, several tests fail because vs cannot find
48 # executables such as cmd.exe ???
49 ifort: false
50 - name: vc2022arm64ninjacross
51 arch: amd64_arm64
52 compiler: msvc2022
53 backend: ninja
54 extraargs: --cross arm64cl.txt --cross-only
55 # ifort doesn't support arm64
56 ifort: false
57
58 steps:
59 - uses: actions/checkout@v6
60
61 - name: Setup Python
62 uses: actions/setup-python@v6
63 with:
64 python-version: '3.7'
65
66 - name: Setup MSVC
67 uses: ilammy/msvc-dev-cmd@v1
68 with:
69 arch: ${{ matrix.arch }}
70
71 - name: Install PyPy
72 if: matrix.arch == 'x64'
73 shell: pwsh
74 run: |
75 $pypyUrl = "https://downloads.python.org/pypy/pypy3.8-v7.3.9-win64.zip"
76 $pypyZip = "${{ runner.temp }}\pypy38.zip"
77 $pypyDir = "${{ runner.temp }}\pypy38"
78 Invoke-WebRequest -Uri $pypyUrl -OutFile $pypyZip
79 Expand-Archive $pypyZip -DestinationPath $pypyDir
80 $pypyPath = "$pypyDir\pypy3.8-v7.3.9-win64"
81 "PYPY_PATH=$pypyPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
82 & "$pypyPath\pypy3.exe" -m ensurepip
83
84 - name: Install Python 2.7
85 if: matrix.arch == 'x64'
86 shell: pwsh
87 run: |
88 $python27Url = "https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi"
89 $python27Msi = "${{ runner.temp }}\python27.msi"
90 Invoke-WebRequest -Uri $python27Url -OutFile $python27Msi
91 Start-Process msiexec.exe -Wait -ArgumentList "/I $python27Msi /quiet"
92
93 - name: Install pkg-config
94 shell: pwsh
95 run: |
96 $pkgconfigDir = "${{ runner.temp }}\pkgconfig"
97 New-Item -ItemType Directory -Path $pkgconfigDir -Force
98 Invoke-WebRequest -Uri "https://raw.githubusercontent.com/mesonbuild/cidata/refs/heads/master/win32/pkg-config.exe" -OutFile "$pkgconfigDir\pkg-config.exe"
99 echo "$pkgconfigDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
100
101 - name: Install NASM
102 shell: pwsh
103 run: choco install -y nasm
104
105 - name: Setup Rust
106 uses: dtolnay/rust-toolchain@stable
107 with:
108 toolchain: stable-x86_64-pc-windows-msvc
109 components: clippy
110
111 - name: Add Rust library path (Windows)
112 run: |
113 $rustlib = (rustc --print sysroot) + "\bin"
114 echo $rustlib | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
115 shell: pwsh
116
117 - name: Install dependencies
118 shell: pwsh
119 run: |
120 python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist pytest-subtests fastjsonschema cython
121
122 - name: Run tests
123 env:
124 MESON_CI_JOBNAME: windows-${{ matrix.name }}
125 shell: pwsh
126 run: |
127 # Remove Chocolatey, MinGW, Strawberry Perl from path
128 $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberry|Chocolatey|PostgreSQL' }) -join ';'
129
130 if ( '${{ matrix.arch }}' -eq 'x64' ) {
131 $env:Path = $env:Path + ";$env:PYPY_PATH"
132 }
133
134 echo "=== PATH BEGIN ==="
135 echo ($env:Path).Replace(';',"`n")
136 echo "=== PATH END ==="
137
138 $progs = @("python","ninja","pkg-config","cl","rc","link","pypy3","ifort")
139 foreach ($prog in $progs) {
140 echo ""
141 echo "Locating ${prog}:"
142 where.exe $prog
143 }
144
145 echo ""
146 echo "Ninja / MSBuild version:"
147 if ($env:backend -eq 'ninja') {
148 ninja --version
149 } else {
150 MSBuild /version
151 }
152
153 echo ""
154 echo "Python version:"
155 python --version
156
157 echo "=== Running tests ==="
158 python 2>&1 run_tests.py --backend "${{ matrix.backend }}" ${{ matrix.extraargs }}