- Trying to set up Windows tests for GitHub actions. #306
Workflow file for this run
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: Tests | |
on: [push] | |
jobs: | |
build: | |
name: Performing tests for Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
env: | |
DISPLAY: :0 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: False | |
matrix: | |
python-version: [3.8, 3.9, 3.10] | |
os: [ubuntu-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
- os: windows-latest | |
path: ~\AppData\Local\pip\Cache | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Environment Variables | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: echo "py_version=$(echo ${{ matrix.python-version }} | tr -d .)" >> $GITHUB_ENV | |
- name: Setup timezone | |
uses: zcong1993/setup-timezone@master | |
with: | |
timezone: UTC | |
- name: Setup xvfb | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb \ | |
libxkbcommon-x11-0 \ | |
libxcb-icccm4 \ | |
libxcb-image0 \ | |
libxcb-keysyms1 \ | |
libxcb-randr0 \ | |
libxcb-render-util0 \ | |
libxcb-xinerama0 \ | |
libxcb-xinput0 \ | |
libxcb-xfixes0 | |
# start xvfb in the background | |
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 & | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: | | |
sudo apt-get install -y $(grep -o ^[^#][[:alnum:]-]*.* "packages.list") | |
python3 -m pip install --upgrade pip | |
pip install wheel | |
pip install https://wxpython.p5k.org/wxPython-4.1.1-cp${{ env.py_version }}-cp${{ env.py_version }}-linux_x86_64.whl | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Compile C-Extensions | |
run: | | |
sudo chmod a+rw /etc/udev/rules.d | |
python3 setup.py install | |
cp ./build/lib.linux-x86_64-${{ matrix.python-version }}/DisplayCAL/lib64/python${{ env.py_version }}/RealDisplaySizeMM.cpython-${{ env.py_version }}-x86_64-linux-gnu.so ./DisplayCAL/lib64/python${{ env.py_version }}/ | |
- name: Test with pytest | |
run: | | |
python -m pytest --verbose --cov=. --cov-report html | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: htmlcov | |
retention-days: 10 |