mirror of
https://github.com/borgbase/vorta
synced 2024-12-23 08:17:08 +00:00
100 lines
2.8 KiB
YAML
100 lines
2.8 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
inputs:
|
|
debug_enabled:
|
|
description: 'Run the build with tmate debugging enabled'
|
|
required: false
|
|
default: false
|
|
|
|
jobs:
|
|
test:
|
|
timeout-minutes: 20
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
python-version: ['3.7', '3.8', '3.9', '3.10']
|
|
os: [ubuntu-18.04, ubuntu-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
id: pip-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
- 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-
|
|
|
|
- name: Install system dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update && sudo apt install -y \
|
|
xvfb libssl-dev openssl libacl1-dev libacl1 build-essential borgbackup \
|
|
libxkbcommon-x11-0 dbus-x11 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
|
|
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libxcb-shape0
|
|
- name: Install system dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install openssl readline xz borgbackup
|
|
- name: Install Vorta
|
|
run: |
|
|
pip install -e .
|
|
pip install -r requirements.d/dev.txt
|
|
|
|
- name: Setup tmate session
|
|
uses: mxschmitt/action-tmate@v3
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
|
|
|
|
- name: Test with pytest (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
xvfb-run --server-args="-screen 0 1024x768x24+32" \
|
|
-a dbus-run-session -- pytest --cov=vorta
|
|
- name: Test with pytest (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
pytest --cov=vorta
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v1
|
|
env:
|
|
OS: ${{ runner.os }}
|
|
python: ${{ matrix.python-version }}
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
env_vars: OS, python
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v1
|
|
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
|
|
run: |
|
|
flake8
|
|
isort --check-only .
|
|
black --check .
|
|
# - name: Run PyLint (info only)
|
|
# run: pylint --rcfile=setup.cfg src --exit-zero
|