Pillow

Форк
0
/
test-windows.yml 
231 строка · 6.7 Кб
1
name: Test Windows
2

3
on:
4
  push:
5
    branches:
6
      - "**"
7
    paths-ignore:
8
      - ".github/workflows/docs.yml"
9
      - ".github/workflows/wheels*"
10
      - ".gitmodules"
11
      - "docs/**"
12
      - "wheels/**"
13
  pull_request:
14
    paths-ignore:
15
      - ".github/workflows/docs.yml"
16
      - ".github/workflows/wheels*"
17
      - ".gitmodules"
18
      - "docs/**"
19
      - "wheels/**"
20
  workflow_dispatch:
21

22
permissions:
23
  contents: read
24

25
concurrency:
26
  group: ${{ github.workflow }}-${{ github.ref }}
27
  cancel-in-progress: true
28

29
env:
30
  COVERAGE_CORE: sysmon
31

32
jobs:
33
  build:
34
    runs-on: windows-latest
35
    strategy:
36
      fail-fast: false
37
      matrix:
38
        python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]
39

40
    timeout-minutes: 30
41

42
    name: Python ${{ matrix.python-version }}
43

44
    steps:
45
    - name: Checkout Pillow
46
      uses: actions/checkout@v4
47

48
    - name: Checkout cached dependencies
49
      uses: actions/checkout@v4
50
      with:
51
        repository: python-pillow/pillow-depends
52
        path: winbuild\depends
53

54
    - name: Checkout extra test images
55
      uses: actions/checkout@v4
56
      with:
57
        repository: python-pillow/test-images
58
        path: Tests\test-images
59

60
    # sets env: pythonLocation
61
    - name: Set up Python
62
      uses: actions/setup-python@v5
63
      with:
64
        python-version: ${{ matrix.python-version }}
65
        allow-prereleases: true
66
        cache: pip
67
        cache-dependency-path: ".github/workflows/test-windows.yml"
68

69
    - name: Print build system information
70
      run: python3 .github/workflows/system-info.py
71

72
    - name: Install Python dependencies
73
      run: >
74
        python3 -m pip install
75
        coverage>=7.4.2
76
        defusedxml
77
        olefile
78
        pyroma
79
        pytest
80
        pytest-cov
81
        pytest-timeout
82

83
    - name: Install dependencies
84
      id: install
85
      run: |
86
        choco install nasm --no-progress
87
        echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
88

89
        choco install ghostscript --version=10.3.1 --no-progress
90
        echo "C:\Program Files\gs\gs10.03.1\bin" >> $env:GITHUB_PATH
91

92
        # Install extra test images
93
        xcopy /S /Y Tests\test-images\* Tests\images
94

95
        # make cache key depend on VS version
96
        & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
97
          | find """catalog_buildVersion""" `
98
          | ForEach-Object { $a = $_.split(" ")[1]; echo "vs=$a" >> $env:GITHUB_OUTPUT }
99
      shell: pwsh
100

101
    - name: Cache build
102
      id: build-cache
103
      uses: actions/cache@v4
104
      with:
105
        path: winbuild\build
106
        key:
107
          ${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }}
108

109
    - name: Prepare build
110
      if: steps.build-cache.outputs.cache-hit != 'true'
111
      run: |
112
        & python.exe winbuild\build_prepare.py -v
113
      shell: pwsh
114

115
    - name: Build dependencies / libjpeg-turbo
116
      if: steps.build-cache.outputs.cache-hit != 'true'
117
      run: "& winbuild\\build\\build_dep_libjpeg.cmd"
118

119
    - name: Build dependencies / zlib
120
      if: steps.build-cache.outputs.cache-hit != 'true'
121
      run: "& winbuild\\build\\build_dep_zlib.cmd"
122

123
    - name: Build dependencies / xz
124
      if: steps.build-cache.outputs.cache-hit != 'true'
125
      run: "& winbuild\\build\\build_dep_xz.cmd"
126

127
    - name: Build dependencies / WebP
128
      if: steps.build-cache.outputs.cache-hit != 'true'
129
      run: "& winbuild\\build\\build_dep_libwebp.cmd"
130

131
    - name: Build dependencies / LibTiff
132
      if: steps.build-cache.outputs.cache-hit != 'true'
133
      run: "& winbuild\\build\\build_dep_libtiff.cmd"
134

135
    # for FreeType CBDT/SBIX font support
136
    - name: Build dependencies / libpng
137
      if: steps.build-cache.outputs.cache-hit != 'true'
138
      run: "& winbuild\\build\\build_dep_libpng.cmd"
139

140
    # for FreeType WOFF2 font support
141
    - name: Build dependencies / brotli
142
      if: steps.build-cache.outputs.cache-hit != 'true'
143
      run: "& winbuild\\build\\build_dep_brotli.cmd"
144

145
    - name: Build dependencies / FreeType
146
      if: steps.build-cache.outputs.cache-hit != 'true'
147
      run: "& winbuild\\build\\build_dep_freetype.cmd"
148

149
    - name: Build dependencies / LCMS2
150
      if: steps.build-cache.outputs.cache-hit != 'true'
151
      run: "& winbuild\\build\\build_dep_lcms2.cmd"
152

153
    - name: Build dependencies / OpenJPEG
154
      if: steps.build-cache.outputs.cache-hit != 'true'
155
      run: "& winbuild\\build\\build_dep_openjpeg.cmd"
156

157
    # GPL licensed
158
    - name: Build dependencies / libimagequant
159
      if: steps.build-cache.outputs.cache-hit != 'true'
160
      run: "& winbuild\\build\\build_dep_libimagequant.cmd"
161

162
    # Raqm dependencies
163
    - name: Build dependencies / HarfBuzz
164
      if: steps.build-cache.outputs.cache-hit != 'true'
165
      run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
166

167
    # Raqm dependencies
168
    - name: Build dependencies / FriBidi
169
      if: steps.build-cache.outputs.cache-hit != 'true'
170
      run: "& winbuild\\build\\build_dep_fribidi.cmd"
171

172
    # trim ~150MB for each job
173
    - name: Optimize build cache
174
      if: steps.build-cache.outputs.cache-hit != 'true'
175
      run: rmdir /S /Q winbuild\build\src
176
      shell: cmd
177

178
    - name: Build Pillow
179
      run: |
180
        $FLAGS="-C raqm=vendor -C fribidi=vendor"
181
        cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe -m pip install -v $FLAGS ."
182
        & $env:pythonLocation\python.exe selftest.py --installed
183
      shell: pwsh
184

185
    # skip PyPy for speed
186
    - name: Enable heap verification
187
      if: "!contains(matrix.python-version, 'pypy')"
188
      run: |
189
        & reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
190

191
    - name: Test Pillow
192
      run: |
193
        path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH%
194
        python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
195
      shell: cmd
196

197
    - name: Prepare to upload errors
198
      if: failure()
199
      run: |
200
        mkdir -p Tests/errors
201
      shell: bash
202

203
    - name: Upload errors
204
      uses: actions/upload-artifact@v4
205
      if: failure()
206
      with:
207
        name: errors
208
        path: Tests/errors
209

210
    - name: After success
211
      run: |
212
        .ci/after_success.sh
213
      shell: pwsh
214

215
    - name: Upload coverage
216
      uses: codecov/codecov-action@v4
217
      with:
218
        file: ./coverage.xml
219
        flags: GHA_Windows
220
        name: ${{ runner.os }} Python ${{ matrix.python-version }}
221
        token: ${{ secrets.CODECOV_ORG_TOKEN }}
222

223
  success:
224
    permissions:
225
      contents: none
226
    needs: build
227
    runs-on: ubuntu-latest
228
    name: Windows Test Successful
229
    steps:
230
      - name: Success
231
        run: echo Windows Test Successful
232

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.