mirror of
https://github.com/borgbase/vorta
synced 2024-12-22 15:57:34 +00:00
b015368fee
Move existing tests into subfolder `tests/unit`. Write integration tests that actually run the installed borg executable. Those tests can be found in `tests/integration`. Those pytest fixtures that are the same for both kinds of tests remain in `tests/conftest.py`. The others can be found in `tests/integration/conftest.py` or `tests/unit/conftest.py`. This adds nox to the project and configures it to run the tests with different borg versions. This also updates the ci workflow to run the integration tests using nox. * noxfile.py : Run pytest with a matrix of borg versions OR a specific borg version * Makefile : Run using nox. Add phonies `test-unit` and `test-integration`. * tests/conftest.py : Move some fixtures/functions to `tests/unit/conftest.py`. * tests/test_*.py --> tests/unit/ : Move unittests and assets into subfolder * tests/integration/ : Write integration tests. * requirements.d/dev.txt: Add `nox` and `pkgconfig`. The latter is needed for installing new borg versions. * .github/actions/setup/action.yml : Update to install pre-commit and nox when needed. The action now no longer installs Vorta. * .github/actions/install-dependencies/action.yml : Install system deps of borg with this new composite action. * .github/workflows/test.yml : Rename `test` ci to `test-unit` and update it for the new test setup. Implement `test-integration` ci. Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: Setup
|
|
description: Sets up python and pre-commit
|
|
|
|
# note:
|
|
# this is a local composite action
|
|
# documentation: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
|
|
# code example: https://github.com/GuillaumeFalourd/poc-github-actions/blob/main/.github/actions/local-action/action.yaml
|
|
|
|
inputs:
|
|
pre-commit:
|
|
description: Whether pre-commit shall be setup, too
|
|
required: false
|
|
default: "" # == false
|
|
python-version:
|
|
description: The python version to install
|
|
required: true
|
|
default: "3.10"
|
|
install-nox:
|
|
description: Whether nox shall be installed
|
|
required: false
|
|
default: "" # == false
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Set up Python ${{ inputs.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
shell: bash
|
|
id: pip-cache
|
|
run: |
|
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
|
- name: pip cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements.d/**') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install pre-commit
|
|
shell: bash
|
|
run: pip install pre-commit
|
|
|
|
- name: Install nox
|
|
if: ${{ inputs.install-nox }}
|
|
shell: bash
|
|
run: pip install nox
|
|
|
|
- name: Hash python version
|
|
if: ${{ inputs.setup-pre-commit }}
|
|
shell: bash
|
|
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
|
|
|
- name: Caching for Pre-Commit
|
|
if: ${{ inputs.setup-pre-commit }}
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pre-commit
|
|
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|