1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-22 15:57:34 +00:00
vorta/.github/workflows/test.yml
2023-08-21 20:31:51 +01:00

146 lines
4.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
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix-unit: ${{ steps.set-matrix-unit.outputs.matrix }}
matrix-integration: ${{ steps.set-matrix-integration.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: Give execute permission to script
run: chmod +x ./.github/scripts/generate-matrix.sh
- name: Generate matrices
run: |
./.github/scripts/generate-matrix.sh "${{ github.event_name }}" "${GITHUB_REF##refs/heads/}"
- name: Set matrix for unit tests
id: set-matrix-unit
run: echo "matrix=$(cat matrix-unit.json)" >> $GITHUB_OUTPUT
- name: Set matrix for integration tests
id: set-matrix-integration
run: echo "matrix=$(cat matrix-integration.json)" >> $GITHUB_OUTPUT
test-unit:
needs: prepare-matrix
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix-unit)}}
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
uses: ./.github/actions/install-dependencies
- name: Setup python, vorta and dev deps
uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
install-nox: true
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
- name: Run Unit Tests with pytest (Linux)
if: runner.os == 'Linux'
env:
BORG_VERSION: ${{ matrix.borg-version }}
run: |
xvfb-run --server-args="-screen 0 1024x768x24+32" \
-a dbus-run-session -- make test-unit
- name: Run Unit Tests with pytest (macOS)
if: runner.os == 'macOS'
env:
BORG_VERSION: ${{ matrix.borg-version }}
PKG_CONFIG_PATH: /usr/local/opt/openssl@3/lib/pkgconfig
run: echo $PKG_CONFIG_PATH && make test-unit
- 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
test-integration:
needs: prepare-matrix
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix-integration)}}
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
uses: ./.github/actions/install-dependencies
- name: Setup python, vorta and dev deps
uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
install-nox: true
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}}
- name: Run Integration Tests with pytest (Linux)
if: runner.os == 'Linux'
env:
BORG_VERSION: ${{ matrix.borg-version }}
run: |
xvfb-run --server-args="-screen 0 1024x768x24+32" \
-a dbus-run-session -- make test-integration
- name: Run Integration Tests with pytest (macOS)
if: runner.os == 'macOS'
env:
BORG_VERSION: ${{ matrix.borg-version }}
PKG_CONFIG_PATH: /usr/local/opt/openssl@3/lib/pkgconfig
run: echo $PKG_CONFIG_PATH && make test-integration
- 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