Compare commits
7 Commits
main
...
f2d36d7874
| Author | SHA1 | Date | |
|---|---|---|---|
| f2d36d7874 | |||
| fa18c64cb3 | |||
| fa68e73e3e | |||
| e3028240b5 | |||
| cc0c5885d2 | |||
| a48ddfe69e | |||
| 983f0f3615 |
@@ -3,19 +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: Add pipx to PATH
|
- name: Install dependencies
|
||||||
run: echo "/root/.local/bin" >> ${GITHUB_PATH}
|
run: |
|
||||||
- name: Install poetry
|
pip install poetry
|
||||||
run: pipx install poetry
|
poetry install --no-interaction
|
||||||
- name: Install poetry package
|
|
||||||
run: poetry install --no-interaction ${{ inputs.poetry_install_args }}
|
|
||||||
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@v6
|
|
||||||
- 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@v6
|
|
||||||
- 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@v6
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.gitea/actions/poetrybuild
|
|
||||||
- name: Test typing with mypy
|
|
||||||
run: poetry run mypy
|
|
||||||
@@ -11,8 +11,8 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
- name: Build and publish to PyPI
|
- name: Build and publish to pypi
|
||||||
uses: https://github.com/JRubics/poetry-publish@v2.1
|
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@v6
|
|
||||||
- name: Check REUSE Compliance
|
|
||||||
uses: https://github.com/fsfe/reuse-action@v6
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
name: Selftests
|
name: Test suites
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -14,13 +14,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
# Test building the package and installing it via pip3
|
# Test building the package and installing it via pip3
|
||||||
test-build-install:
|
test-build-install:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
- name: Add pipx to PATH
|
|
||||||
run: echo "/root/.local/bin" >> ${GITHUB_PATH}
|
|
||||||
- name: Install poetry
|
- name: Install poetry
|
||||||
run: pipx install poetry
|
run: pip install poetry
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: poetry build
|
run: poetry build
|
||||||
- name: Install package
|
- name: Install package
|
||||||
@@ -31,15 +29,12 @@ jobs:
|
|||||||
seafile-mirror --help
|
seafile-mirror --help
|
||||||
|
|
||||||
# Run tool and sync a test library
|
# Run tool and sync a test library
|
||||||
test-sync:
|
selftest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
uses: ./.gitea/actions/poetrybuild
|
uses: ./.gitea/actions/poetrybuild
|
||||||
# using minimal set of dependencies
|
|
||||||
with:
|
|
||||||
poetry_install_args: "--without dev"
|
|
||||||
- name: Install seaf-cli
|
- name: Install seaf-cli
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -57,3 +52,41 @@ jobs:
|
|||||||
run: poetry run seafile-mirror -c tests -v
|
run: poetry run seafile-mirror -c tests -v
|
||||||
- name: Attempt to find expected string in library
|
- name: Attempt to find expected string in library
|
||||||
run: grep "__ci_test_expect__" tests/ci-test/testfile.txt
|
run: grep "__ci_test_expect__" 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/
|
|
||||||
|
|||||||
956
poetry.lock
generated
956
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "seafile-mirror"
|
name = "seafile-mirror"
|
||||||
version = "0.2.2"
|
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"
|
||||||
@@ -20,13 +20,12 @@ python = "^3.10"
|
|||||||
pyyaml = "^6.0.1"
|
pyyaml = "^6.0.1"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pylint = "^4.0.0"
|
pylint = "^3.0.0"
|
||||||
isort = "^8.0.0"
|
isort = "^5.12.0"
|
||||||
black = "^26.0.0"
|
black = "^23.9.1"
|
||||||
mypy = "^1.5.1"
|
mypy = "^1.5.1"
|
||||||
pylama = "^8.4.1"
|
pylama = "^8.4.1"
|
||||||
types-pyyaml = "^6.0.12.11"
|
types-pyyaml = "^6.0.12.11"
|
||||||
bump-my-version = "^1.0.0"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
@@ -42,16 +41,3 @@ line-length = 100
|
|||||||
# MYPY settings
|
# MYPY settings
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
files = ["seafile_mirror/*.py"]
|
files = ["seafile_mirror/*.py"]
|
||||||
|
|
||||||
# Bump-My-Version
|
|
||||||
[tool.bumpversion]
|
|
||||||
commit = true
|
|
||||||
tag = true
|
|
||||||
allow_dirty = false
|
|
||||||
tag_name = "v{new_version}"
|
|
||||||
|
|
||||||
[[tool.bumpversion.files]]
|
|
||||||
filename = "pyproject.toml"
|
|
||||||
regex = true
|
|
||||||
search = "^version = \"{current_version}\""
|
|
||||||
replace = "version = \"{new_version}\""
|
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
{
|
{
|
||||||
$schema: "https://docs.renovatebot.com/renovate-schema.json",
|
$schema: "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
extends: ["local>renovate-bot/renovate-config"],
|
extends: ["local>renovate-bot/renovate-config"],
|
||||||
"packageRules": [
|
|
||||||
// Group and merge all dev dependencies, even major versions
|
|
||||||
{
|
|
||||||
"matchDepTypes": ["dev"],
|
|
||||||
"groupName": "all-dev-dependencies",
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
// Merge all other patch and minor dependencies
|
|
||||||
{
|
|
||||||
"matchUpdateTypes": ["minor", "patch"],
|
|
||||||
"matchCurrentVersion": "!/^0/",
|
|
||||||
"automerge": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ from ._seafile import (
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("-c", "--configdir", required=True, help="The config directory")
|
parser.add_argument("-c", "--configdir", required=True, help="The config directory")
|
||||||
parser.add_argument(
|
|
||||||
"-l",
|
|
||||||
"--logfile",
|
|
||||||
help="The path to the logfile. Default: <configdir>/seafile_mirror.log",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-d",
|
"-d",
|
||||||
"--dry",
|
"--dry",
|
||||||
@@ -57,17 +52,14 @@ parser.add_argument(
|
|||||||
parser.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
parser.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
||||||
|
|
||||||
|
|
||||||
def main(): # pylint: disable=too-many-locals, too-many-statements, too-many-branches
|
def main(): # pylint: disable=too-many-locals, too-many-statements
|
||||||
"""Main function"""
|
"""Main function"""
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# Set files depending on configdir
|
# Set files depending on configdir
|
||||||
configdir = args.configdir.rstrip("/") + "/"
|
configdir = args.configdir.rstrip("/") + "/"
|
||||||
configfile = configdir + "seafile_mirror.conf.yaml"
|
configfile = configdir + "seafile_mirror.conf.yaml"
|
||||||
cachefile = configdir + ".seafile_mirror.db.json"
|
cachefile = configdir + ".seafile_mirror.db.json"
|
||||||
if args.logfile:
|
logfile = configdir + "seafile_mirror.log"
|
||||||
logfile = args.logfile
|
|
||||||
else:
|
|
||||||
logfile = configdir + "seafile_mirror.log"
|
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
|
|||||||
@@ -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