Don't attempt to import fcntl on Windows #203
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: [push, pull_request] | |
jobs: | |
run-tests: | |
name: Run tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- os: macos-latest | |
python-version: "3.10" | |
openssl-version: "3" | |
- os: macos-latest | |
python-version: "3.11" | |
openssl-version: "3" | |
- os: macos-latest | |
python-version: "3.12" | |
openssl-version: "3" | |
exclude: | |
# test hangs on these combination | |
- os: windows-latest | |
python-version: "3.8" | |
- os: windows-latest | |
python-version: "3.9" | |
- os: windows-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.11" | |
- os: windows-latest | |
python-version: "3.12" | |
runs-on: ${{ matrix.os }} | |
env: | |
liboqs_version: '0.7.2' | |
nettle_version: nettle_3.8.1_release_20220727 | |
steps: | |
- name: Checkout asyncssh | |
uses: actions/checkout@v3 | |
with: | |
path: asyncssh | |
- name: Checkout liboqs | |
if: ${{ runner.os != 'macOS' }} | |
uses: actions/checkout@v3 | |
with: | |
repository: open-quantum-safe/liboqs | |
ref: ${{ env.liboqs_version }} | |
path: liboqs | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: | | |
asyncssh/setup.py | |
asyncssh/tox.ini | |
- name: Set up ccache for liboqs (Linux) | |
uses: hendrikmuhs/[email protected] | |
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 libsodium-dev libssl-dev libkrb5-dev ssh cmake ninja-build | |
- name: Install macOS dependencies | |
if: ${{ runner.os == 'macOS' }} | |
run: brew install nettle liboqs libsodium openssl | |
- name: Provide OpenSSL 3 | |
if: ${{ runner.os == 'macOS' && matrix.openssl-version == '3' }} | |
run: echo "/usr/local/opt/openssl@3/bin" >> $GITHUB_PATH | |
- 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@v3 | |
with: | |
name: coverage | |
path: asyncssh/.coverage.* | |
retention-days: 1 | |
report-coverage: | |
name: Report coverage | |
runs-on: ubuntu-latest | |
needs: run-tests | |
if: ${{ always() }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.7" | |
- uses: actions/download-artifact@v3 | |
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@v3 | |
with: | |
files: coverage.xml |