Skip to content

Commit

Permalink
resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLazron committed Mar 18, 2024
2 parents e4900a1 + d721011 commit c42be5f
Show file tree
Hide file tree
Showing 150 changed files with 6,788 additions and 2,766 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_form.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Bug Report Form"
description: "Report a bug or a similiar issue."
description: "Report a bug or a similar issue."
body:
- type: markdown
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug Report
about: Report a bug or a similiar issue - the classic way
about: Report a bug or a similar issue - the classic way
title: ''
labels: ''
assignees: ''
Expand All @@ -18,7 +18,7 @@ If you want to suggest a feature or have any other question, please use our
#### Description

<!-- Description
Please decribe your issue and its context in a clear and concise way.
Please describe your issue and its context in a clear and concise way.
Please try to reproduce the issue and provide the steps to reproduce it.
-->

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Feature Request
about: Suggest an idea for this project.
title: 'FR: '
labels: 'type:enhancement'
title: ''
labels: ''
assignees: ''

---
Expand Down
22 changes: 22 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Install Dependencies
description: Installs system dependencies

runs:
using: "composite"
steps:
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt update && sudo apt install -y \
xvfb libssl-dev openssl libacl1-dev libacl1 fuse3 build-essential \
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 libfuse-dev libsqlite3-dev libfuse3-dev pkg-config \
python3-pkgconfig libxxhash-dev borgbackup
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
brew install openssl readline xz xxhash pkg-config borgbackup
17 changes: 12 additions & 5 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ inputs:
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:
Expand All @@ -37,16 +40,20 @@ runs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install Vorta
- name: Install pre-commit
shell: bash
run: |
pip install -e .
pip install -r requirements.d/dev.txt
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
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- [ ] All new and existing tests passed.


*I provide my contribution under the terms of the [license](./../../LICENSE.txt) of this repository and I affirm the [Developer Certificate of Origin][dco].*
*I provide my contribution under the terms of the [license](./../LICENSE.txt) of this repository and I affirm the [Developer Certificate of Origin][dco].*

[dco]: https://developercertificate.org/

Expand Down
30 changes: 30 additions & 0 deletions .github/scripts/generate-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
event_name="$1"
branch_name="$2"

if [[ "$event_name" == "workflow_dispatch" ]] || [[ "$branch_name" == "master" ]]; then
echo '{
"python-version": ["3.8", "3.9", "3.10", "3.11"],
"os": ["ubuntu-latest", "macos-latest"],
"borg-version": ["1.2.4"]
}' | jq -c . > matrix-unit.json

echo '{
"python-version": ["3.8", "3.9", "3.10", "3.11"],
"os": ["ubuntu-latest", "macos-latest"],
"borg-version": ["1.1.18", "1.2.2", "1.2.4", "2.0.0b5"],
"exclude": [{"borg-version": "2.0.0b5", "python-version": "3.8"}]
}' | jq -c . > matrix-integration.json

elif [[ "$event_name" == "push" ]] || [[ "$event_name" == "pull_request" ]]; then
echo '{
"python-version": ["3.8", "3.9", "3.10", "3.11"],
"os": ["ubuntu-latest", "macos-latest"],
"borg-version": ["1.2.4"]
}' | jq -c . > matrix-unit.json

echo '{
"python-version": ["3.10"],
"os": ["ubuntu-latest"],
"borg-version": ["1.2.4"]
}' | jq -c . > matrix-integration.json
fi
62 changes: 33 additions & 29 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
name: Close stale issues
on:
schedule:
- cron: '50 1 * * *'

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
days-before-issue-stale: 60
days-before-pr-stale: -1
days-before-issue-close: 7
# days-before-pr-close: 10

# Issues with these labels will never be considered stale
exemptLabels:
- "status:idea"
- "status:planning"
- "status:on hold"
- "status:ready"
- "type:bug"
- "type:docs"
- "type:enhancement"
- "type:feature"
- "type:refactor"
- "type:task"
stale-issue-label: "status:stale"
stale-pr-label: "status:stale"

# Label to use when marking an issue as stale
staleLabel: "status:stale"
exempt-issue-labels: >
status:idea,
status:planning,
status:on hold,
status:ready,
type:bug,
type:docs,
type:enhancement,
type:feature,
type:refactor,
type:task,
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

# Limit to only `issues` or `pulls`
only: issues
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
close-issue-message: >
This issue was closed because it has been stalled for 7 days with no activity.
1 change: 1 addition & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
APPLE_ID_USER: ${{ secrets.APPLE_ID_USER }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p 123 build.keychain
Expand Down
104 changes: 85 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,49 +26,115 @@ jobs:
shell: bash
run: make lint

test:
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:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest]
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix-unit)}}

steps:
- uses: actions/checkout@v3

- name: Install system dependencies (Linux)
- 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: |
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)
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'
run: |
brew install openssl readline xz borgbackup
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 }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}}

- name: Test with pytest (Linux)
- 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
- name: Test with pytest (macOS)
-a dbus-run-session -- make test-integration
- name: Run Integration Tests with pytest (macOS)
if: runner.os == 'macOS'
run: make test
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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ src/vorta/i18n/ts/vorta.en.ts
src/vorta/i18n/ts/vorta.en_US.ts
flatpak/app/
flatpak/.flatpak-builder/
.vscode
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ VERSION := $(shell python -c "from src.vorta._version import __version__; print(
.PHONY : help clean lint test
.DEFAULT_GOAL := help

# Set Homebrew location to /opt/homebrew on Apple Silicon, /usr/local on Intel
ifeq ($(shell uname -m),arm64)
export HOMEBREW = /opt/homebrew
else
export HOMEBREW = /usr/local
endif

clean:
rm -rf dist/*

dist/Vorta.app: ## Build macOS app locally (without Borg)
pyinstaller --clean --noconfirm package/vorta.spec
cp -R /usr/local/Caskroom/sparkle/*/Sparkle.framework dist/Vorta.app/Contents/Frameworks/
cp -R ${HOMEBREW}/Caskroom/sparkle/*/Sparkle.framework dist/Vorta.app/Contents/Frameworks/
rm -rf build/vorta dist/vorta

dist/Vorta.dmg: dist/Vorta.app ## Create notarized macOS DMG for distribution.
Expand Down Expand Up @@ -60,7 +67,13 @@ lint:
pre-commit run --all-files --show-diff-on-failure

test:
pytest --cov=vorta
nox -- --cov=vorta

test-unit:
nox -- --cov=vorta tests/unit

test-integration:
nox -- --cov=vorta tests/integration

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Loading

0 comments on commit c42be5f

Please sign in to comment.