From 739dff7cb030aedb3e1a38168b3fe893d2771345 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sun, 10 Jul 2022 14:54:41 +0100 Subject: [PATCH] Add Deepsource --- .deepsource.toml | 30 +++++++++ .../ci-branch-main.yml | 0 .../ci-development.yml | 0 .../pull-request.yml} | 0 .github/workflows/merge-to-main.yml | 65 +++++++++++++++++++ .github/workflows/pull-request.yml | 36 ++++++++++ CODEOWNERS | 1 + README.md | 2 +- renovate.json | 44 +++++++++++-- 9 files changed, 173 insertions(+), 5 deletions(-) create mode 100644 .deepsource.toml rename .github/{workflows => workflows-disabled}/ci-branch-main.yml (100%) rename .github/{workflows => workflows-disabled}/ci-development.yml (100%) rename .github/{workflows/ci-pull-request.yml => workflows-disabled/pull-request.yml} (100%) create mode 100644 .github/workflows/merge-to-main.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 CODEOWNERS diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..5309bc2 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,30 @@ +version = 1 + +test_patterns = ["tests/**"] + +exclude_patterns = [ + ".github/workflows/**", + ".gitignore", + "CODEOWNERS", + "LICENSE.md", + "README.md", + "codecov.yml", + "renovate.json", + "requirements-dev.txt", + "requirements.txt" +] + +[[analyzers]] +name = "python" +enabled = true + + [analyzers.meta] + runtime_version = "3.x.x" + +[[analyzers]] +name = "test-coverage" +enabled = true + +[[transformers]] +name = "black" +enabled = true diff --git a/.github/workflows/ci-branch-main.yml b/.github/workflows-disabled/ci-branch-main.yml similarity index 100% rename from .github/workflows/ci-branch-main.yml rename to .github/workflows-disabled/ci-branch-main.yml diff --git a/.github/workflows/ci-development.yml b/.github/workflows-disabled/ci-development.yml similarity index 100% rename from .github/workflows/ci-development.yml rename to .github/workflows-disabled/ci-development.yml diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows-disabled/pull-request.yml similarity index 100% rename from .github/workflows/ci-pull-request.yml rename to .github/workflows-disabled/pull-request.yml diff --git a/.github/workflows/merge-to-main.yml b/.github/workflows/merge-to-main.yml new file mode 100644 index 0000000..ed9402e --- /dev/null +++ b/.github/workflows/merge-to-main.yml @@ -0,0 +1,65 @@ +name: Merge to main +on: + push: + branches: + - main + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies + run: pip install -r requirements.txt && pip install -r requirements-dev.txt + - name: Run test suite + run: | + coverage run -m py.test -v + coverage xml + - name: Report results to DeepSource + run: | + curl https://deepsource.io/cli | sh + ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml + env: + DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} + + build: + needs: coverage + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Setup Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install build dependencies + run: pip install setuptools wheel + - name: Build wheel file + run: python setup.py bdist_wheel + - id: skip_check + uses: actions/upload-artifact@v3 + with: + name: whl + path: dist/ + + publish: + needs: build + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + steps: + - name: Create dist folder + run: mkdir -p dist + - uses: actions/download-artifact@v3 + with: + name: whl + path: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..f3f442f --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,36 @@ +name: CI +on: + pull_request: + paths-ignore: + - 'README.md' + - 'LICENSE.md' + - '.gitignore' + - 'CODEOWNERS' + - 'renovate.json' + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies + run: pip install -r requirements.txt && pip install -r requirements-dev.txt + - name: Lint + run: pylint --recursive=yes . + - name: Run test suite + run: | + coverage run -m py.test -v + coverage xml + - name: Report results to DeepSource + run: | + curl https://deepsource.io/cli | sh + ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml + env: + DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..0d35f6e --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @luketainton \ No newline at end of file diff --git a/README.md b/README.md index 8b4eb2b..dfe433e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# iPilot [![CI](https://github.com/luketainton/pypilot/actions/workflows/ci-branch-main.yml/badge.svg)](https://github.com/luketainton/pypilot/actions/workflows/ci-branch-main.yml) +# iPilot [![CI](https://github.com/luketainton/pypilot/actions/workflows/ci-branch-main.yml/badge.svg)](https://github.com/luketainton/pypilot/actions/workflows/ci-branch-main.yml) [![DeepSource](https://deepsource.io/gh/luketainton/pypilot.svg/?label=active+issues&show_trend=true&token=8utkyLrh7RPelvS-BNX1O8hZ)](https://deepsource.io/gh/luketainton/pypilot/?ref=repository-badge) ## Description IP Information Lookup Tool diff --git a/renovate.json b/renovate.json index 8b6dd1e..4eaf727 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,42 @@ { - "extends": [ - "config:base" - ] + "extends": [ + "config:base" + ], + "platformCommit": true, + "dependencyDashboardAutoclose": true, + "assignAutomerge": true, + "assigneesFromCodeOwners": true, + "rebaseWhen": "behind-base-branch", + "rollbackPrs": true, + "labels": [ + "dependencies" + ], + "packageRules": [ + { + "matchPackagePatterns": [ + "black", + "pylint" + ], + "labels": [ + "linting" + ] + }, + { + "matchPackagePatterns": [ + "coverage", + "pytest" + ], + "labels": [ + "unit-tests" + ] + } + ], + "vulnerabilityAlerts": { + "enabled": true, + "labels": [ + "security" + ], + "commitMessagePrefix": "[SECURITY] ", + "prCreation": "immediate" } - \ No newline at end of file +} \ No newline at end of file -- 2.47.2