Compare commits
13 Commits
v0.2.0
...
9443255911
| Author | SHA1 | Date | |
|---|---|---|---|
| 9443255911 | |||
| 1abf7ddd08 | |||
| 64af877b51 | |||
| 870fe312d7 | |||
| 91e4a622ad | |||
| 50f6064fa8 | |||
| 83567afa2a | |||
| fb26f5b723 | |||
| c53532efc7 | |||
| 5b0ff38265 | |||
| 4a612f81ad | |||
| 781575468b | |||
| 9bbd95396c |
@@ -3,17 +3,11 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
name: "Reusable Poetry build workflow"
|
name: "Reusable Poetry build workflow"
|
||||||
inputs:
|
|
||||||
poetry_install_args:
|
|
||||||
default: ""
|
|
||||||
description: "Value for additional poetry install arguments"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Install poetry
|
- name: Install dependencies
|
||||||
run: pip install poetry
|
run: |
|
||||||
- name: Install poetry package
|
pip install poetry
|
||||||
run: poetry install --no-interaction ${{ inputs.poetry_install_args }}
|
poetry install --no-interaction
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
name: Python Linters
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pylint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.gitea/actions/poetrybuild
|
|
||||||
- name: Lint with pylint
|
|
||||||
run: poetry run pylint seafile_mirror
|
|
||||||
|
|
||||||
formatting:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.gitea/actions/poetrybuild
|
|
||||||
- name: Test formatting with isort and black
|
|
||||||
run: |
|
|
||||||
poetry run isort --check seafile_mirror/
|
|
||||||
poetry run black .
|
|
||||||
|
|
||||||
mypy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.gitea/actions/poetrybuild
|
|
||||||
- name: Test typing with mypy
|
|
||||||
run: poetry run mypy
|
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build and publish to PyPI
|
- name: Build and publish to pypi
|
||||||
uses: https://github.com/JRubics/poetry-publish@v1.17
|
uses: https://github.com/JRubics/poetry-publish@v1.17
|
||||||
with:
|
with:
|
||||||
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
name: REUSE Compliance
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
reuse:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Check REUSE Compliance
|
|
||||||
uses: https://github.com/fsfe/reuse-action@v2
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 DB Systel GmbH
|
|
||||||
# SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
name: Selftests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Test building the package and installing it via pip3
|
|
||||||
test-build-install:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install poetry
|
|
||||||
run: pip install poetry
|
|
||||||
- name: Build package
|
|
||||||
run: poetry build
|
|
||||||
- name: Install package
|
|
||||||
run: pip3 install dist/seafile_mirror-*.tar.gz
|
|
||||||
- name: Run package
|
|
||||||
run: |
|
|
||||||
seafile-mirror --version
|
|
||||||
seafile-mirror --help
|
|
||||||
|
|
||||||
# Run tool and sync a test library
|
|
||||||
test-sync:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.gitea/actions/poetrybuild
|
|
||||||
# using minimal set of dependencies
|
|
||||||
with:
|
|
||||||
poetry_install_args: "--without dev"
|
|
||||||
- name: Install seaf-cli
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y seafile-cli
|
|
||||||
- name: Configure seaf-cli and start daemon
|
|
||||||
run: |
|
|
||||||
seaf-cli init -d /tmp
|
|
||||||
seaf-cli start
|
|
||||||
- name: Fill configuration for test library
|
|
||||||
run: |
|
|
||||||
sed -i "s|__seafile_server__|${{ secrets.SEAFILE_SERVER }}|" tests/seafile_mirror.conf.yaml
|
|
||||||
sed -i "s|__seafile_user__|${{ secrets.SEAFILE_USER }}|" tests/seafile_mirror.conf.yaml
|
|
||||||
sed -i "s|__seafile_pass__|${{ secrets.SEAFILE_PASS }}|" tests/seafile_mirror.conf.yaml
|
|
||||||
- name: Sync the library
|
|
||||||
run: poetry run seafile-mirror -c tests -v
|
|
||||||
- name: Attempt to find expected string in library
|
|
||||||
run: grep "__ci_test_expect__" tests/ci-test/testfile.txt
|
|
||||||
111
.gitea/workflows/test.yaml
Normal file
111
.gitea/workflows/test.yaml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2023 DB Systel GmbH
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
name: Test suites
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# # Test using the tool via poetry on different OSes and python versions
|
||||||
|
# test-os-python-matrix:
|
||||||
|
# runs-on: ${{ matrix.os }}
|
||||||
|
# strategy:
|
||||||
|
# max-parallel: 10
|
||||||
|
# # do not abort the whole test job if one combination in the matrix fails
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# python-version: ["3.9", "3.10", "3.11"]
|
||||||
|
# os: [ubuntu-20.04]
|
||||||
|
# include:
|
||||||
|
# - python-version: "3.9"
|
||||||
|
# os: macos-latest
|
||||||
|
# - python-version: "3.9"
|
||||||
|
# os: windows-latest
|
||||||
|
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v2
|
||||||
|
# - uses: ./.gitea/actions/poetrybuild
|
||||||
|
# - name: Execute seafile-mirror
|
||||||
|
# run: poetry run ossrfc --help
|
||||||
|
|
||||||
|
# Test building the package and installing it via pip3
|
||||||
|
test-build-install:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install poetry
|
||||||
|
run: pip install poetry
|
||||||
|
- name: Build package
|
||||||
|
run: poetry build
|
||||||
|
- name: Install package
|
||||||
|
run: pip3 install dist/seafile_mirror-*.tar.gz
|
||||||
|
- name: Run package
|
||||||
|
run: seafile-mirror --help
|
||||||
|
|
||||||
|
# Run tool and sync a test library
|
||||||
|
selftest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.gitea/actions/poetrybuild
|
||||||
|
- name: Install seaf-cli
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y seafile-cli
|
||||||
|
- name: Configure seaf-cli and start daemon
|
||||||
|
run: |
|
||||||
|
seaf-cli init -d /tmp
|
||||||
|
seaf-cli start
|
||||||
|
- name: Fill configuration for test library
|
||||||
|
run: |
|
||||||
|
sed -i "s|__seafile_server__|${{ secrets.SEAFILE_SERVER }}|" tests/seafile_mirror.conf.yaml
|
||||||
|
sed -i "s|__seafile_user__|${{ secrets.SEAFILE_USER }}|" tests/seafile_mirror.conf.yaml
|
||||||
|
sed -i "s|__seafile_pass__|${{ secrets.SEAFILE_PASS }}|" tests/seafile_mirror.conf.yaml
|
||||||
|
- name: Sync the library
|
||||||
|
run: poetry run seafile-mirror -c tests -v
|
||||||
|
- name: Attempt to find expected string in library
|
||||||
|
run: grep "__ci_test_expectXXX__" tests/ci-test/testfile.txt
|
||||||
|
|
||||||
|
# PYLINT / BLACK / ISORT / MYPY
|
||||||
|
pylint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.gitea/actions/poetrybuild
|
||||||
|
- name: Lint with pylint
|
||||||
|
run: poetry run pylint seafile_mirror
|
||||||
|
|
||||||
|
formatting:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.gitea/actions/poetrybuild
|
||||||
|
- name: Test formatting with isort and black
|
||||||
|
run: |
|
||||||
|
poetry run isort --check seafile_mirror/
|
||||||
|
poetry run black .
|
||||||
|
|
||||||
|
mypy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.gitea/actions/poetrybuild
|
||||||
|
- name: Test typing with mypy
|
||||||
|
run: poetry run mypy
|
||||||
|
|
||||||
|
# REUSE COMPLIANCE
|
||||||
|
reuse:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check REUSE Compliance
|
||||||
|
uses: https://github.com/fsfe/reuse-action@v2
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,4 +8,3 @@ venv/
|
|||||||
/seafile_mirror.conf.yaml
|
/seafile_mirror.conf.yaml
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.log
|
*.log
|
||||||
tests/ci-test/
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "seafile-mirror"
|
name = "seafile-mirror"
|
||||||
version = "0.2.0"
|
version = "0.1.0"
|
||||||
description = "Handle clean read-only (re-)syncs of Seafile libraries to mirror them"
|
description = "Handle clean read-only (re-)syncs of Seafile libraries to mirror them"
|
||||||
authors = ["Max Mehl <mail@mehl.mx>"]
|
authors = ["Max Mehl <mail@mehl.mx>"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
# SPDX-FileCopyrightText: 2023 Max Mehl <https://mehl.mx>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
|
||||||
"""Global init file"""
|
|
||||||
|
|
||||||
from importlib.metadata import version
|
|
||||||
|
|
||||||
__version__ = version("seafile-mirror")
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from time import sleep
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from . import __version__
|
|
||||||
from ._cachedb import db_read
|
from ._cachedb import db_read
|
||||||
from ._helpers import convert_bytes, findstring, get_lock
|
from ._helpers import convert_bytes, findstring, get_lock
|
||||||
from ._seafile import (
|
from ._seafile import (
|
||||||
@@ -49,10 +48,9 @@ parser.add_argument(
|
|||||||
default=False,
|
default=False,
|
||||||
help="Print and log DEBUG messages",
|
help="Print and log DEBUG messages",
|
||||||
)
|
)
|
||||||
parser.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
|
||||||
|
|
||||||
|
|
||||||
def main(): # pylint: disable=too-many-locals, too-many-statements
|
def main():
|
||||||
"""Main function"""
|
"""Main function"""
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# Set files depending on configdir
|
# Set files depending on configdir
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Configuration file for seafile-mirror which will be filled in and applied in
|
# Example configuration file for seafile-mirror
|
||||||
# the CI test
|
|
||||||
- server: __seafile_server__
|
- server: __seafile_server__
|
||||||
user: __seafile_user__
|
user: __seafile_user__
|
||||||
password: __seafile_pass__
|
password: __seafile_pass__
|
||||||
|
|||||||
Reference in New Issue
Block a user