File: run_tests.yml

package info (click to toggle)
python-asyncssh 2.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,468 kB
  • sloc: python: 40,314; makefile: 11
file content (167 lines) | stat: -rw-r--r-- 5,087 bytes parent folder | download
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
name: Run tests
on: [push, pull_request]

permissions:
  contents: read

jobs:
  run-tests:
    name: Run tests
    permissions:
      contents: read
      actions: write
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

    runs-on: ${{ matrix.os }}
    env:
      liboqs_version: '0.10.1'
      nettle_version: nettle_3.8.1_release_20220727

    steps:
      - name: Checkout asyncssh
        uses: actions/checkout@v4
        with:
          path: asyncssh

      - name: Checkout liboqs
        if: ${{ runner.os != 'macOS' }}
        uses: actions/checkout@v4
        with:
          repository: open-quantum-safe/liboqs
          ref: ${{ env.liboqs_version }}
          path: liboqs

      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: pip
          cache-dependency-path: |
            asyncssh/setup.py
            asyncssh/tox.ini

      - name: Fix modules path for OpenSSL on Windows
        if: ${{ runner.os == 'Windows' }}
        shell: pwsh
        run: |
          $openssl_path = ((Get-Command openssl).Path | Split-Path -Parent)
          echo "OPENSSL_MODULES=$openssl_path" >> $env:GITHUB_ENV

      - name: Verify legacy provider can be enabled in OpenSSL on Windows
        if: ${{ runner.os == 'Windows' }}
        shell: pwsh
        run: |
          openssl list -provider default -provider legacy -providers

      - name: Set up ccache for liboqs (Linux)
        uses: hendrikmuhs/ccache-action@v1.2
        if: ${{ runner.os == 'Linux' }}
        with:
          key: liboqs-cache-${{ matrix.os }}

      - name: Install Linux dependencies
        if: ${{ runner.os == 'Linux' }}
        run: |
          sudo apt update
          sudo apt install -y --no-install-recommends libnettle8 libssl-dev libkrb5-dev ssh cmake ninja-build

      - name: Install macOS dependencies
        if: ${{ runner.os == 'macOS' }}
        run: brew install nettle liboqs

      - name: Install nettle (Windows)
        if: ${{ runner.os == 'Windows' }}
        shell: pwsh
        run: |
          curl -fLO https://github.com/ShiftMediaProject/nettle/releases/download/${{ env.nettle_version }}/libnettle_${{ env.nettle_version }}_msvc17.zip
          Expand-Archive libnettle_${{ env.nettle_version }}_msvc17.zip nettle
          cp nettle\bin\x64\*.dll "$env:Python_ROOT_DIR"

      - name: Install liboqs (Linux)
        if: ${{ runner.os == 'Linux' }}
        working-directory: liboqs
        run: |
          cmake -GNinja -Bbuild . -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -DOQS_BUILD_ONLY_LIB=ON -DOQS_DIST_BUILD=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache
          cmake --build build
          sudo cmake --install build

      - name: Initialize MSVC environment
        uses: ilammy/msvc-dev-cmd@v1

      - name: Install liboqs (Windows)
        if: ${{ runner.os == 'Windows' }}
        shell: pwsh
        working-directory: liboqs
        run: |
          cmake -GNinja -Bbuild . -DBUILD_SHARED_LIBS=ON -DOQS_BUILD_ONLY_LIB=ON -DOQS_DIST_BUILD=ON
          cmake --build build
          cp build\bin\oqs.dll "$env:Python_ROOT_DIR"

      - name: Install Python dependencies
        run: pip install tox

      - name: Run tests
        shell: python
        working-directory: asyncssh
        run: |
          import os, sys, platform, subprocess
          V = sys.version_info
          p = platform.system().lower()
          subprocess.run(
              ['tox', 'run', '-e', f'py{V.major}{V.minor}-{p}', '--', '-ra'],
              check=True)

      - name: Upload coverage data
        uses: actions/upload-artifact@v4
        with:
          name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
          path: asyncssh/.coverage.*
          include-hidden-files: true
          retention-days: 1

  merge-coverage:
    runs-on: ubuntu-latest
    needs: run-tests
    if: ${{ always() }}
    permissions:
      actions: write
    steps:
      - name: Merge coverage
        uses: actions/upload-artifact/merge@v4
        with:
          name: coverage
          pattern: coverage-*
          include-hidden-files: true

  report-coverage:
    name: Report coverage
    runs-on: ubuntu-latest
    needs: merge-coverage
    if: ${{ always() }}
    permissions:
      contents: read
      actions: read
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
      - uses: actions/download-artifact@v4
        with:
          name: coverage
      - name: Install dependencies
        run: |
          sudo apt install -y sqlite3
          pip install tox
      - name: Report coverage
        run: |
          shopt -s nullglob
          for f in .coverage.*-windows; do
            sqlite3 "$f" "update file set path = replace(path, '\\', '/');"
          done
          tox -e report
      - uses: codecov/codecov-action@v4
        with:
          files: coverage.xml
          token: ${{ secrets.CODECOV_TOKEN }}