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:
|
2023-02-17 13:57:21 +00:00
|
|
|
type: boolean
|
2023-05-28 15:41:58 +00:00
|
|
|
description: "Run the build with tmate debugging enabled"
|
2021-04-18 13:33:48 +00:00
|
|
|
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:
|
2023-05-28 15:41:58 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup python, vorta and dev deps
|
|
|
|
uses: ./.github/actions/setup
|
|
|
|
with:
|
|
|
|
python-version: 3.11
|
|
|
|
pre-commit: true
|
2022-08-15 17:02:40 +00:00
|
|
|
|
2023-05-28 15:41:58 +00:00
|
|
|
- name: Test formatting with Flake8, ruff and Black
|
|
|
|
shell: bash
|
|
|
|
run: make lint
|
2022-08-15 17:02:40 +00:00
|
|
|
|
2023-08-21 19:31:51 +00:00
|
|
|
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
|
|
|
|
|
2023-08-05 13:49:45 +00:00
|
|
|
test-unit:
|
2023-08-21 19:31:51 +00:00
|
|
|
needs: prepare-matrix
|
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
|
2023-08-21 19:31:51 +00:00
|
|
|
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix-unit)}}
|
2020-03-03 05:19:36 +00:00
|
|
|
|
|
|
|
steps:
|
2023-05-28 15:41:58 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2023-08-05 13:49:45 +00:00
|
|
|
- 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
|
2023-08-21 19:31:51 +00:00
|
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
|
2023-08-05 13:49:45 +00:00
|
|
|
|
|
|
|
- name: Run Unit Tests with pytest (Linux)
|
2023-05-28 15:41:58 +00:00
|
|
|
if: runner.os == 'Linux'
|
2023-08-05 13:49:45 +00:00
|
|
|
env:
|
|
|
|
BORG_VERSION: ${{ matrix.borg-version }}
|
2023-05-28 15:41:58 +00:00
|
|
|
run: |
|
2023-08-05 13:49:45 +00:00
|
|
|
xvfb-run --server-args="-screen 0 1024x768x24+32" \
|
2023-08-21 19:31:51 +00:00
|
|
|
-a dbus-run-session -- make test-unit
|
2023-08-05 13:49:45 +00:00
|
|
|
|
|
|
|
- name: Run Unit Tests with pytest (macOS)
|
2023-05-28 15:41:58 +00:00
|
|
|
if: runner.os == 'macOS'
|
2023-08-05 13:49:45 +00:00
|
|
|
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:
|
2023-08-21 19:31:51 +00:00
|
|
|
needs: prepare-matrix
|
2023-08-05 13:49:45 +00:00
|
|
|
timeout-minutes: 20
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2023-08-21 19:31:51 +00:00
|
|
|
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix-integration)}}
|
2023-08-05 13:49:45 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install system dependencies
|
|
|
|
uses: ./.github/actions/install-dependencies
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2023-05-28 15:41:58 +00:00
|
|
|
- name: Setup python, vorta and dev deps
|
|
|
|
uses: ./.github/actions/setup
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-08-05 13:49:45 +00:00
|
|
|
install-nox: true
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2023-05-28 15:41:58 +00:00
|
|
|
- name: Setup tmate session
|
|
|
|
uses: mxschmitt/action-tmate@v3
|
2023-08-21 19:31:51 +00:00
|
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}}
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2023-08-05 13:49:45 +00:00
|
|
|
- name: Run Integration Tests with pytest (Linux)
|
2023-05-28 15:41:58 +00:00
|
|
|
if: runner.os == 'Linux'
|
2023-08-05 13:49:45 +00:00
|
|
|
env:
|
|
|
|
BORG_VERSION: ${{ matrix.borg-version }}
|
2023-05-28 15:41:58 +00:00
|
|
|
run: |
|
|
|
|
xvfb-run --server-args="-screen 0 1024x768x24+32" \
|
2023-08-21 19:31:51 +00:00
|
|
|
-a dbus-run-session -- make test-integration
|
2023-08-05 13:49:45 +00:00
|
|
|
|
|
|
|
- name: Run Integration Tests with pytest (macOS)
|
2023-05-28 15:41:58 +00:00
|
|
|
if: runner.os == 'macOS'
|
2023-08-05 13:49:45 +00:00
|
|
|
env:
|
|
|
|
BORG_VERSION: ${{ matrix.borg-version }}
|
|
|
|
PKG_CONFIG_PATH: /usr/local/opt/openssl@3/lib/pkgconfig
|
|
|
|
run: echo $PKG_CONFIG_PATH && make test-integration
|
2021-02-22 01:45:43 +00:00
|
|
|
|
2023-05-28 15:41:58 +00:00
|
|
|
- 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
|