ci: tests: drop AppVeyor and move Windows testing to GitHub actions

To avoid having to separately handle the different virtual environment
binary directories under Linux and Windows, emulate Linux || Windows
venv activation by directly manipulating the PATH.
This commit is contained in:
Jonas Malaco 2022-02-27 10:10:52 -03:00
parent feb582a3a1
commit ed28fb9373
5 changed files with 36 additions and 53 deletions

View File

@ -5,51 +5,82 @@ on: [push, pull_request]
jobs:
build:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 10
matrix:
python-version: ['3.10', '3.9', '3.8', '3.7']
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
# mac os: exclude all but the last two python releases
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.7
# windows: exclude all but the last two python releases
- os: windows-latest
python-version: 3.8
- os: windows-latest
python-version: 3.7
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libudev-dev
- name: Install system dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install libusb
- name: Install system dependencies (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
curl --remote-name --location https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.7z
7z x libusb-1.0.25.7z
cp VS2019\MS64\Release\dll\* C:\Windows\System32
- name: Install Python tools
run: |
python -m pip install --upgrade pip
- name: Set up a test environment with pytest and the runtime dependencies
run: |
python -m venv vtest
vtest/bin/python -m pip install colorlog docopt hidapi pytest pyusb "smbus; sys_platform == 'linux'"
export PATH=vtest/bin/:vtest/Scripts/:$PATH
pip install colorlog docopt hidapi pytest pyusb "smbus; sys_platform == 'linux'"
- name: Run unit tests and module doctests
run: |
XDG_RUNTIME_DIR=.tests_rundir vtest/bin/python -m pytest
export PATH=vtest/bin/:vtest/Scripts/:$PATH
XDG_RUNTIME_DIR=.tests_rundir python -m pytest
- name: Set up a environment to install into, and install the package from sources
run: |
python -m venv vinstall
vinstall/bin/python -m pip install .
export PATH=vinstall/bin/:vinstall/Scripts/:$PATH
python -m pip install .
- name: Test that the installed executable is able to probe for devices
run: |
vinstall/bin/liquidctl list --verbose --debug
export PATH=vinstall/bin/:vinstall/Scripts/:$PATH
liquidctl list --verbose --debug
- name: Lint with flake8
run: |
python -m pip install flake8

View File

@ -1,2 +1 @@
exclude appveyor.yml
recursive-exclude .github *

View File

@ -3,7 +3,6 @@
_Cross-platform tool and drivers for liquid coolers and other devices_
[![Status of the tests](https://github.com/liquidctl/liquidctl/workflows/tests/badge.svg)](https://github.com/liquidctl/liquidctl/commits/main)
[![Status of the build for Windows](https://ci.appveyor.com/api/projects/status/n5lgebd5m8iomx42/branch/main?svg=true)](https://ci.appveyor.com/project/jonasmalacofilho/liquidctl/branch/main)
[![Developer's Discord server](https://img.shields.io/discord/780568774964805672)](https://discord.gg/GyCBjQhqCd)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4949/badge)](https://bestpractices.coreinfrastructure.org/projects/4949)

View File

@ -1,43 +0,0 @@
version: "{build}"
skip_commits:
message: /\[skip ci\]/
image:
- Visual Studio 2019
platform: x64
environment:
DIST_NAME: AppVeyor
LIBUSB_VERSION: 1.0.25
for:
-
branches:
only:
- /v\d+\.\d+\.\d+.*/
environment:
is_release: true
install:
# conditionally generate DIST_PACKAGE from TAG_NAME or REPO_COMMIT:
# - because of AppVeyor limitation, do this here and not in environment;
# - don't be sane and use 'else', Windows/Cmd/AppVeyor wont like it
- cmd: if [%is_release%]==[true] set DIST_PACKAGE=liquidctl-%APPVEYOR_REPO_TAG_NAME:v=%-bin-windows-x86_64
- cmd: if [%is_release%]==[] set DIST_PACKAGE=liquidctl-%APPVEYOR_REPO_COMMIT:~0,12%-bin-windows-x86_64
- cmd: echo DIST_NAME=%DIST_NAME%; DIST_PACKAGE=%DIST_PACKAGE%; LIBUSB_VERSION=%LIBUSB_VERSION%
# libusb
- cmd: appveyor DownloadFile https://github.com/libusb/libusb/releases/download/v%LIBUSB_VERSION%/libusb-%LIBUSB_VERSION%.7z -FileName libusb.7z
- cmd: 7z x libusb.7z
# build and test tools
- cmd: C:\Python310-x64\python -m pip install --upgrade pip pytest
# copy the libusb DLLs
- cmd: copy VS2019\MS64\Release\dll\* C:\Windows\System32\
# project and dependencies
- cmd: C:\Python310-x64\python -m pip install .
build: off
test_script:
- cmd: C:\Python310-x64\python -m pytest

View File

@ -135,9 +135,6 @@ build]. You can also browse all recent builds for all branches and features
been worked on in the [build history]; the executables are in the "artifacts"
tab.
[current build]: https://ci.appveyor.com/project/jonasmalacofilho/liquidctl/branch/main/artifacts
[build history]: https://ci.appveyor.com/project/jonasmalacofilho/liquidctl/history
## Final words
While you should be able to use liquidctl with just these tips, I still