mirror of
https://github.com/borgbase/vorta
synced 2025-01-03 05:36:19 +00:00
5a3a7cf58e
Fix phonies in Makefile and run pre-commit for lint target. Instead of running black, flake8 and ruff the lint phony now runs pre-commit which has these tools configured as hooks. * Makefile Define common composite action for setting up pre-commit and python. * .github/actions/setup/action.yml * .github/workflows/test.yml Update codecov/codecov-action used in test ci to v3. * .github/workflows/test.yml
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
inputs:
|
|
debug_enabled:
|
|
type: boolean
|
|
description: "Run the build with tmate debugging enabled"
|
|
required: false
|
|
default: false
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup python, vorta and dev deps
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
python-version: 3.11
|
|
pre-commit: true
|
|
|
|
- name: Test formatting with Flake8, ruff and Black
|
|
shell: bash
|
|
run: make lint
|
|
|
|
test:
|
|
timeout-minutes: 20
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- 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 \
|
|
libegl1 libxcb-cursor0
|
|
- name: Install system dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install openssl readline xz borgbackup
|
|
|
|
- name: Setup python, vorta and dev deps
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- 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 -- make test
|
|
- name: Test with pytest (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: make test
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
env:
|
|
OS: ${{ runner.os }}
|
|
python: ${{ matrix.python-version }}
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
env_vars: OS, python
|