Skip to content

extract Execution and close the job lifecycle (#2360, goal 2) #3327

extract Execution and close the job lifecycle (#2360, goal 2)

extract Execution and close the job lifecycle (#2360, goal 2) #3327

Workflow file for this run

name: Test
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled"
required: false
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup python, vorta and dev deps
uses: ./.github/actions/setup
with:
python-version: ${{ vars.PYTHON_VERSION || '3.12' }}
pre-commit: true
- name: Test formatting with ruff
shell: bash
run: uv run pre-commit run --all-files --show-diff-on-failure
- name: Type check with mypy
shell: bash
run: uv run mypy src/vorta/store/ src/vorta/network_status/
test-unit:
timeout-minutes: 120 # macos tests are very slow
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Broad matrix on master / workflow_dispatch; narrow on PRs and non-master pushes.
# Bump versions here as needed.
matrix: >-
${{ fromJSON(
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master'))
&& '{"python-version":["3.10","3.12","3.13"],"os":["ubuntu-24.04","macos-15"],"borg-version":["1.4.4"]}'
|| '{"python-version":["3.12"],"os":["ubuntu-24.04","macos-15"],"borg-version":["1.4.4"]}'
) }}
steps:
- uses: actions/checkout@v4
- 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: Validate Flatpak manifest
if: runner.os == 'Linux'
shell: bash
run: appstreamcli validate ./src/vorta/assets/metadata/com.borgbase.Vorta.appdata.xml
- 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@v4
env:
OS: ${{ runner.os }}
python: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS, python
test-integration:
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: >-
${{ fromJSON(
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master'))
&& '{"python-version":["3.12"],"os":["ubuntu-24.04"],"borg-version":["1.2.8","1.4.4"]}'
|| '{"python-version":["3.12"],"os":["ubuntu-24.04"],"borg-version":["1.4.4"]}'
) }}
steps:
- uses: actions/checkout@v4
- 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@v4
env:
OS: ${{ runner.os }}
python: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS, python
version: v0.7.3 # workaround on Intel macs (GH Actions)
# Stable-named aggregate gate for branch protection. Matrix jobs above embed
# the Borg version in their auto-generated check names (e.g.
# "test-unit (3.12, ubuntu-24.04, 1.4.4)"), so requiring them directly breaks
# protection on every version bump. Require this job instead.
required-checks:
name: required-checks
if: always()
needs:
- lint
- test-unit
- test-integration
runs-on: ubuntu-latest
steps:
- name: Verify all required jobs succeeded
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: |
echo "One or more required jobs failed or were cancelled."
exit 1