From 195b5e98156059083c15fa4a32ce8b4280812655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Trifir=C3=B2?= Date: Wed, 11 Jan 2023 18:56:29 +0100 Subject: [PATCH 1/2] update template --- .cruft.json | 2 +- .github/workflows/release.yaml | 24 +++++--- .github/workflows/tests.yaml | 83 ++++++++------------------ .github/workflows/update-template.yaml | 4 +- setup.cfg | 13 ++-- 5 files changed, 52 insertions(+), 74 deletions(-) diff --git a/.cruft.json b/.cruft.json index 85c3e20..e54c154 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/iterative/cookiecutter-dvc-plugin", - "commit": "5e07217326c0c136274315e550e3932668a407a7", + "commit": "1c708b3f9ce614fc7fd5674d69643f9b24225f32", "checkout": null, "context": { "cookiecutter": { diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index adcce1c..5d5457c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,25 +1,31 @@ name: Release + on: release: types: [published] + +permissions: + contents: read + jobs: pip: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set up Python 3.8 - uses: actions/setup-python@v3 + - uses: actions/setup-python@v3 with: python-version: 3.8 - - name: Build packages + - name: Install run: | - pip install -U pip - pip install -U build setuptools>=58.2 - python -m build --sdist --wheel --outdir dist/ + pip install --upgrade pip wheel + pip install build twine + - name: Build + run: | + python -m build + twine check dist/* - name: Publish packages to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d1cd0b4..aae42b9 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,42 +1,21 @@ name: Tests on: - pull_request: {} - push: {} + push: + branches: [main] + pull_request: schedule: - cron: '5 1 * * *' # every day at 01:05 - workflow_dispatch: -env: - DVC_TEST: "true" - HOMEBREW_NO_AUTO_UPDATE: 1 - SHELL: /bin/bash +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read jobs: - lint: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2.4.0 - with: - fetch-depth: 0 - - name: Set up Python 3.8 - uses: actions/setup-python@v2.2.2 - with: - python-version: 3.8 - - name: Install requirements - run: | - pip install wheel - pip install -e '.[tests]' - pip install git+https://github.com/iterative/dvc pre-commit - - name: Check README - run: python setup.py checkdocs - - uses: pre-commit/action@v2.0.3 tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} @@ -44,46 +23,36 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-latest, macos-latest] - pyv: ["3.8", "3.9", "3.10"] - exclude: - # no wheels for pygit2 yet - - os: windows-latest - pyv: "3.10" + pyv: ["3.8", "3.9", "3.10", "3.11"] + steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Set up Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.pyv }} - - name: get pip cache dir - id: pip-cache-dir - run: | - echo "::set-output name=dir::$(pip cache dir)" - - name: set pip cache - id: pip-cache - uses: actions/cache@v2.1.6 - with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }} - restore-keys: | - ${{ runner.os }}-pip- + cache: 'pip' + cache-dependency-path: setup.cfg + - name: install - if: steps.cache.pip-cache-dir.cache-hit != 'true' run: | - pip install --upgrade pip setuptools wheel + pip install --upgrade pip wheel pip install -e ".[tests]" - pip install "dvc[testing]@git+https://github.com/iterative/dvc" - - name: setup git - run: | - git config --global user.email "dvctester@example.com" - git config --global user.name "DVC Tester" + pip install "dvc[testing] @ git+https://github.com/iterative/dvc" + + - name: lint + timeout-minutes: 10 + uses: pre-commit/action@v3.0.0 + - name: run tests timeout-minutes: 40 run: pytest -v -n=auto --cov-report=xml --cov-report=term + - name: upload coverage report - uses: codecov/codecov-action@v2.1.0 + uses: codecov/codecov-action@v3 with: file: ./coverage.xml fail_ci_if_error: false diff --git a/.github/workflows/update-template.yaml b/.github/workflows/update-template.yaml index 3aa58b1..d4963aa 100644 --- a/.github/workflows/update-template.yaml +++ b/.github/workflows/update-template.yaml @@ -3,14 +3,13 @@ name: Update template on: schedule: - cron: '5 1 * * *' # every day at 01:05 - workflow_dispatch: jobs: update: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps run: pip install cruft - name: Update template @@ -25,4 +24,3 @@ jobs: commit-message: update template title: update template token: ${{ secrets.WORKFLOW_TOKEN }} - diff --git a/setup.cfg b/setup.cfg index e451288..75ffebb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ classifiers = Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [options] setup_requires = @@ -70,11 +71,15 @@ tests = [flake8] ignore= - E203, # Whitespace before ':' - E266, # Too many leading '#' for block comment - W503, # Line break occurred before a binary operator - P1, # unindexed parameters in the str.format, see: + # Whitespace before ':' + E203, + # Too many leading '#' for block comment + E266, + # Line break occurred before a binary operator + W503, + # unindexed parameters in the str.format, see: # https://pypi.org/project/flake8-string-format/ + P1, max_line_length = 79 max-complexity = 15 select = B,C,E,F,W,T4,B902,T,P From 0d8c0c933d75388fdb0eea3cc6bfdc866558d763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Trifir=C3=B2?= Date: Thu, 12 Jan 2023 13:44:31 +0100 Subject: [PATCH 2/2] deps: get rid of pylint-pytest, bump pylint, silence warnings --- dvc_ssh/tests/fixtures.py | 8 ++++++-- pyproject.toml | 5 ++--- setup.cfg | 4 +--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dvc_ssh/tests/fixtures.py b/dvc_ssh/tests/fixtures.py index 917cb8c..9bc5dbb 100644 --- a/dvc_ssh/tests/fixtures.py +++ b/dvc_ssh/tests/fixtures.py @@ -1,3 +1,5 @@ +# pylint: disable=redefined-outer-name + import os import pytest @@ -6,12 +8,14 @@ @pytest.fixture(scope="session") -def docker_compose_file(pytestconfig): +def docker_compose_file(pytestconfig): # pylint: disable=unused-argument return os.path.join(os.path.dirname(__file__), "docker-compose.yml") @pytest.fixture(scope="session") -def ssh_server(docker_compose, docker_services): +def ssh_server( # pylint: disable=unused-argument + docker_compose, docker_services +): import asyncssh from sshfs import SSHFileSystem diff --git a/pyproject.toml b/pyproject.toml index 5834857..2289bd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,12 +54,11 @@ files = ["dvc_ssh"] [tool.pylint.master] extension-pkg-whitelist = ["pygit2"] init-hook = "import sys; sys.path.append(str('tests'))" -load-plugins = ["pylint_pytest"] [tool.pylint.message_control] disable = [ - "format", "refactoring", "spelling", "design", "no-self-use", - "invalid-name", "misplaced-comparison-constant", "duplicate-code", "fixme", + "format", "refactoring", "spelling", "design", + "invalid-name", "duplicate-code", "fixme", "unused-wildcard-import", "cyclic-import", "wrong-import-order", "wrong-import-position", "ungrouped-imports", "multiple-imports", "logging-format-interpolation", "logging-fstring-interpolation", diff --git a/setup.cfg b/setup.cfg index 75ffebb..c170629 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,9 +55,7 @@ tests = collective.checkdocs==0.2 pydocstyle==6.1.1 # pylint requirements - pylint==2.11.1 - # we use this to suppress pytest-related false positives in our tests. - pylint-pytest==1.1.2 + pylint==2.15.9 # we use this to suppress some messages in tests, eg: foo/bar naming, # and, protected method calls in our tests pylint-plugin-utils==0.6