summaryrefslogtreecommitdiff
path: root/appveyor.yml
blob: e5f00fb906a0b5e3a351a6f91af268ebf2c24808 (plain)
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
branches:
  only:
    - master
    - /windows.*/

environment:
  global:
    # All security sensitive variables have to be encrypted!
    # https://ci.appveyor.com/account/mcepl/tools/encrypt
    # https://www.appveyor.com/docs/build-configuration/#secure-variables
    USER:
        secure: oqWqarxnd4H23FMywnlQeg==
    PASS:
        secure: j/VSxdYJ7mdR44u8OdywLg==
    X86_OPENSSL_INSTALLER: Win32OpenSSL-1_1_1t.exe
    X64_OPENSSL_INSTALLER: Win64OpenSSL-1_1_1t.exe
    # Random password, never used anywhere else
    APPVEYOR_RDP_PASSWORD: MmXt9yk3rNah3CGcRWad3XD
    PYPI_USERNAME: __token__
    PYPI_PASSWORD:
        secure: d8luupfz+8NXAuOFgYa+opNTwFYSk5lCcLj+SAcNe5xsprkB54ChOC+wVztT2ascdJqhU5U9KH1xE7gajYcmo4/fd2r1yJTGSdL6L0PGkNzMYGfVZ35GYESMvdezz42cQOmHzJ3WmymA5XoeyRH74I07VsHgDkYvk5Iz6fwZ1vxkNQbL02hD5IDRABkjm/gjmaYBHGhUi+NZ197jFpuMClrFhjqG87M0+oj8dbVperkYF4pKxeDsM4HofsgOxqRbjxSJtcrOcyhTYOWrrbWA1g==

  matrix:
    # Pre-installed Python versions, which Appveyor may upgrade to
    # a later point release.
   
    - PYTHON: "C:\\Python38"
      PYTHON_VERSION: "3.8.x"
      PYTHON_ARCH: "32"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win32"
      PYWIN32: "pywin32-305.win32-py3.8.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win32-3.8"

    - PYTHON: "C:\\Python38-x64"
      PYTHON_VERSION: "3.8.x"
      PYTHON_ARCH: "64"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win64"
      PYWIN32: "pywin32-305.win-amd64-py3.8.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win-amd64-3.8"

    - PYTHON: "C:\\Python39"
      PYTHON_VERSION: "3.9.x"
      PYTHON_ARCH: "32"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win32"
      PYWIN32: "pywin32-305.win32-py3.9.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win32-3.9"

    - PYTHON: "C:\\Python39-x64"
      PYTHON_VERSION: "3.9.x"
      PYTHON_ARCH: "64"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win64"
      PYWIN32: "pywin32-305.win-amd64-py3.9.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win-amd64-3.9"

    - PYTHON: "C:\\Python310"
      PYTHON_VERSION: "3.10.x"
      PYTHON_ARCH: "32"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win32"
      PYWIN32: "pywin32-305.win32-py3.10.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win32-cpython-310"

    - PYTHON: "C:\\Python310-x64"
      PYTHON_VERSION: "3.10.x"
      PYTHON_ARCH: "64"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win64"
      PYWIN32: "pywin32-305.win-amd64-py3.10.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win-amd64-cpython-310"

    - PYTHON: "C:\\Python311"
      PYTHON_VERSION: "3.11.x"
      PYTHON_ARCH: "32"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win32"
      PYWIN32: "pywin32-305.win32-py3.11.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win32-cpython-311"

    - PYTHON: "C:\\Python311-x64"
      PYTHON_VERSION: "3.11.x"
      PYTHON_ARCH: "64"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win64"
      PYWIN32: "pywin32-305.win-amd64-py3.11.exe"
      PYWIN32_RELEASE: b305
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PYTHONPATH_DIR: "win-amd64-cpython-311"

    - PYTHON: "C:\\Python27-x64"
      PYTHON_VERSION: "2.7.x" # currently 2.7.9
      PYTHON_ARCH: "64"
      OPENSSL_PATH: "C:\\OpenSSL-1-1-Win64"
      PYWIN32: "pywin32-228.win-amd64-py2.7.exe"
      PYWIN32_RELEASE: b228
      PYTHONPATH_DIR: "win-amd64-2.7"

matrix:
    allow_failures:
      - PYTHON: "C:\\Python27-x64"

nuget:
    account_feed: true

install:
  # Install non-python dependencies using chocolatey package manager
  - choco install -r -y swig

  # Install Python (from the official .msi of http://python.org) and pip when
  # not already installed.
  - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }

  # Prepend newly installed Python to the PATH of this build (this cannot be
  # done from inside the powershell script as it would require to restart
  # the parent CMD process).
  - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%;%OPENSSL_PATH%\\bin"

  # Check that we have the expected version and architecture for Python
  - "python --version"
  - "python -c \"import struct; print(struct.calcsize('P') * 8)\""

  # Install the build dependencies of the project. If some dependencies contain
  # compiled extensions and are not provided as pre-built wheel packages,
  # pip will build them from source using the MSVC compiler matching the
  # target Python version and architecture
  - "%PYTHON%\\Scripts\\pip.exe install -r dev-requirements.txt"

  - ECHO "Install OpenSSL 32bit"
  - curl -o "c:\\%X86_OPENSSL_INSTALLER%" -fsSL "https://slproweb.com/download/%X86_OPENSSL_INSTALLER%"
  - "c:\\%X86_OPENSSL_INSTALLER% /silent /verysilent /DIR=C:\\OpenSSL-1-1-Win32"

  - ECHO "Install OpenSSL 64bit"
  - curl -o "c:\\%X64_OPENSSL_INSTALLER%" -fsSL "https://slproweb.com/download/%X64_OPENSSL_INSTALLER%"
  - "c:\\%X64_OPENSSL_INSTALLER% /silent /verysilent /DIR=C:\\OpenSSL-1-1-Win64"

  - ECHO "Install pywin32"
  - "python -m pip install pywin32"
  #- mkdir pywin32
  #- 7z x "%PYWIN32%" -opywin32
  #- xcopy /e "pywin32\\PLATLIB" "%PYTHON%\\Lib\\site-packages"

  - ECHO "Filesystem root:"
  - ps: "ls \"C:/\""

  - ps: "ls \"C:/OpenSSL-Win32\""
  - ECHO "Installed SDKs:"
  - ps: if (Test-Path "C:/Program Files/Microsoft SDKs/Windows") { ls "C:/Program Files/Microsoft SDKs/Windows" }

  - ECHO "Appveyor OpenSSL Version (%OPENSSL_VERSION%)"
  - "%OPENSSL_PATH%/bin/openssl.exe  version"

  - ECHO "Python OpenSSL Version (%PYTHON%)"
  - "%PYTHON%\\python.exe -c \"import ssl; print(getattr(ssl, 'OPENSSL_VERSION', None))\""
# init:
#    - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

build_script:
  - "%PYTHON%\\python.exe setup.py build --openssl=\"%OPENSSL_PATH%\" --bundledlls"

test_script:
  - "dir .\\build"
  - "SET PYTHONPATH=.\\build\\lib.%PYTHONPATH_DIR%"
  - "%PYTHON%\\python.exe -mtap discover -v tests"

after_test:
  # If tests are successful, create a whl package for the project.
  - "%PYTHON%\\python.exe setup.py bdist_wheel"
  - "dir .\\dist"

artifacts:
  # Archive the generated wheel package in the ci.appveyor.com build report.
  - path: dist\*

  - path: src/SWIG/_m2crypto_wrap.c
    name: _m2crypto_wrap.zip
    type: zip

on_success:
  - ps: |
      If ($env:APPVEYOR_REPO_TAG -eq "true") {
          Invoke-Expression -erroraction 'silentlycontinue' "twine upload -u $env:PYPI_USERNAME -p $env:PYPI_PASSWORD --skip-existing dist/*" 
      }

on_finish:
  - ps: Get-ChildItem src\SWIG\_m2crypto_wrap.c | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
  - "SET PYTHONPATH="
#   - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))