Add Deepsource #12

Merged
luketainton merged 2 commits from feat/deepsource into main 2022-07-10 15:57:40 +02:00
8 changed files with 171 additions and 6 deletions

30
.deepsource.toml Normal file
View File

@ -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

65
.github/workflows/merge-to-main.yml vendored Normal file
View File

@ -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 }}

36
.github/workflows/pull-request.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -1,8 +1,42 @@
{
"labels": ["dependencies"],
"assignAutomerge": true,
"assigneesFromCodeOwners": true,
"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"
}
}