summaryrefslogtreecommitdiff
path: root/.github/workflows/tests.yml
blob: 7cc905f242a7f39bd5b121af725d442c645ba8f9 (plain)
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
name: 'Tests'


on:
  push:
    branches: [ '**' ]


defaults:
  run:
    shell: bash


jobs:
  build:
    env:
      DISPLAY: :0
  test-python:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        python-version: [ '3.10' ] # '3.7', '3.8', '3.9'
    name: 'Python'
    steps:
      - uses: actions/checkout@v2
      - name: 'Install Python'
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: 'Install pip'
        run: |
          function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; }
          execute python -m pip install --upgrade pip
      - 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 wheel
          execute python -m pip install -r tests/requirements.txt
      - name: 'Run Python Tests'
        run: |
          function execute() { echo -e "\033[0;34m$*\033[0m"; "$@"; }
          source venv/bin/activate
          execute python -m pytest