summaryrefslogtreecommitdiff
path: root/.github/workflows/ci-windows.yml
blob: 313c8b55a3a34d13f5955f7ab7275b7b8b1bee92 (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
name: CI-Windows

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: windows-latest
    env:
      VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
    strategy:
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10"]
      fail-fast: false
    permissions:
      packages: write

    steps:
    - uses: actions/checkout@v3
    - uses: ilammy/msvc-dev-cmd@v1
      with:
        arch: 'x86'
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
        architecture: 'x86'
    - name: 'Setup NuGet credentials'
      shell: 'bash'
      run: |
        nuget="$(vcpkg fetch nuget | tail -n 1)"
        "${nuget}" \
          sources add \
          -source "https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json" \
          -storepasswordincleartext \
          -name "GitHub" \
          -username "${GITHUB_REPOSITORY_OWNER}" \
          -password "${{ secrets.GITHUB_TOKEN }}"
        "${nuget}" \
          setapikey "${{ secrets.GITHUB_TOKEN }}" \
          -source "https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json"
    - name: Install packages
      run: vcpkg install curl[core,http2,non-http,openssl,ssh]:x86-windows
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install wheel delvewheel
        pip install flake8 pytest -r requirements-dev.txt
    - name: Build
      run: python setup.py bdist_wheel --with-openssl --curl-dir=$env:VCPKG_INSTALLATION_ROOT/packages/curl_x86-windows --openssl-dir=$env:VCPKG_INSTALLATION_ROOT/packages/openssl_x86-windows --openssl-lib-name=libssl.lib --link-arg=libcrypto.lib
    - name: Repair & install built wheel
      run: |
        delvewheel repair --add-path $VCPKG_INSTALLATION_ROOT/installed/x86-windows/bin dist/*.whl
        pip install wheelhouse/*.whl
      shell: bash
    - name: Test with pytest
      run: pytest -v