name: 'Tests' on: push: branches: [ '**' ] defaults: run: shell: bash jobs: test-linux: runs-on: ubuntu-22.04 name: 'Linux - Python' strategy: matrix: # '3.7' -> E ImportError: cannot import name 'InvalidStateError' from 'concurrent.futures' (/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/concurrent/futures/__init__.py) python-version: [ '3.8', '3.9', '3.10' ] env: DISPLAY: :0 PY_MPV_SKIP_TESTS: >- test_wait_for_property_event_overflow steps: - uses: actions/checkout@v3 - name: 'Install Python' uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: 'Update Packages' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute sudo apt update -y && sudo apt upgrade -y - name: 'Install Dependencies' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute sudo apt install -y libmpv1 xvfb - name: 'Start Xvfb' run: | echo -e "\033[0;34msudo /usr/bin/Xvfb $DISPLAY -screen 0 1920x1080x24 &\033[0m"; sudo /usr/bin/Xvfb $DISPLAY -screen 0 1920x1080x24 & - name: 'Create Virtual Environment' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute python -m venv venv execute source venv/bin/activate execute python -m pip install --upgrade pip execute python -m pip install wheel execute python -m pip install -r tests/requirements.txt - name: 'Run Python Tests' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute source venv/bin/activate execute xvfb-run python -m pytest test-windows: runs-on: windows-latest name: 'Windows - Python' strategy: matrix: python-version: [ '3.8', '3.9', '3.10' ] steps: - uses: actions/checkout@v3 - name: 'Install Python' uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: 'Setup Build Environment' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute python -m venv venv execute source venv/Scripts/activate execute python -m pip install --upgrade pip execute python -m pip install wheel execute python -m pip install -r tests/requirements.txt - name: 'Provide libmpv' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } ARTIFACT="mpv-dev-x86_64-20220619-git-c1a46ec.7z" URL="https://sourceforge.net/projects/mpv-player-windows/files/libmpv/$ARTIFACT" execute curl -L -O "$URL" execute 7z x "$ARTIFACT" execute mv mpv-2.dll tests - name: 'Run Python Tests' run: | function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; } execute source venv/Scripts/activate execute python -m pytest