2020-03-03 05:19:36 +00:00
|
|
|
name: Test
|
|
|
|
|
2021-04-18 13:33:48 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
debug_enabled:
|
|
|
|
description: 'Run the build with tmate debugging enabled'
|
|
|
|
required: false
|
|
|
|
default: false
|
2020-03-03 05:19:36 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-08-15 13:43:00 +00:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-10-15 11:53:29 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-15 13:43:00 +00:00
|
|
|
- name: Set up Python 3.8
|
2023-01-16 18:57:28 +00:00
|
|
|
uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4.3.1
|
2022-08-15 13:43:00 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
- name: Install Vorta
|
|
|
|
run: |
|
|
|
|
pip install .
|
|
|
|
pip install -r requirements.d/dev.txt
|
|
|
|
- name: Test formatting with Flake8, isort and Black
|
2023-01-20 11:25:58 +00:00
|
|
|
run: make lint
|
2022-08-15 13:43:00 +00:00
|
|
|
# - name: Run PyLint (info only)
|
|
|
|
# run: pylint --rcfile=setup.cfg src --exit-zero
|
2022-08-15 17:02:40 +00:00
|
|
|
|
|
|
|
|
2020-03-03 05:19:36 +00:00
|
|
|
test:
|
2021-02-18 01:44:10 +00:00
|
|
|
timeout-minutes: 20
|
2020-03-03 05:19:36 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
matrix:
|
2022-12-23 16:25:35 +00:00
|
|
|
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
|
|
|
|
os: [ubuntu-latest, macos-latest]
|
2020-03-03 05:19:36 +00:00
|
|
|
|
|
|
|
steps:
|
2022-10-15 11:53:29 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2023-01-16 18:57:28 +00:00
|
|
|
uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4.3.1
|
2020-03-03 05:19:36 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2021-02-22 01:45:43 +00:00
|
|
|
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
2023-01-16 18:57:28 +00:00
|
|
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
2021-02-22 01:45:43 +00:00
|
|
|
- name: pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements.d/**') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
|
|
|
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Install system dependencies (Linux)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2020-06-22 08:16:46 +00:00
|
|
|
sudo apt update && sudo apt install -y \
|
2021-02-18 01:44:10 +00:00
|
|
|
xvfb libssl-dev openssl libacl1-dev libacl1 build-essential borgbackup \
|
2020-08-10 07:57:13 +00:00
|
|
|
libxkbcommon-x11-0 dbus-x11 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
|
2022-07-25 09:07:38 +00:00
|
|
|
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libxcb-shape0
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Install system dependencies (macOS)
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
2021-02-18 01:44:10 +00:00
|
|
|
brew install openssl readline xz borgbackup
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Install Vorta
|
|
|
|
run: |
|
2021-02-18 05:50:58 +00:00
|
|
|
pip install -e .
|
2020-03-03 05:19:36 +00:00
|
|
|
pip install -r requirements.d/dev.txt
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2021-04-18 13:33:48 +00:00
|
|
|
- name: Setup tmate session
|
|
|
|
uses: mxschmitt/action-tmate@v3
|
|
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Test with pytest (Linux)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2021-02-18 01:44:10 +00:00
|
|
|
xvfb-run --server-args="-screen 0 1024x768x24+32" \
|
2023-01-20 11:25:58 +00:00
|
|
|
-a dbus-run-session -- make test
|
2020-03-03 05:19:36 +00:00
|
|
|
- name: Test with pytest (macOS)
|
|
|
|
if: runner.os == 'macOS'
|
2023-01-20 11:25:58 +00:00
|
|
|
run: make test
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2020-11-18 23:47:14 +00:00
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|
2021-01-20 04:59:37 +00:00
|
|
|
env:
|
2020-12-01 04:12:40 +00:00
|
|
|
OS: ${{ runner.os }}
|
|
|
|
python: ${{ matrix.python-version }}
|
2020-11-18 23:47:14 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2020-12-01 04:12:40 +00:00
|
|
|
env_vars: OS, python
|