Skip to content

Commit

Permalink
Merge 169ff04 into 9114744
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermef committed Jul 25, 2022
2 parents 9114744 + 169ff04 commit 84f8ee2
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 28 deletions.
6 changes: 6 additions & 0 deletions .flake8
@@ -0,0 +1,6 @@
[flake8]
ignore = W801,E501,W605,W504,W606,W503,E203,E266,W1505
max-line-length = 88
max-complexity = 20
select = B,C,E,F,W,T4
exclude = ./.tox/*,./build/*,./docs/conf.py,./.env,./.venv
8 changes: 8 additions & 0 deletions .github/codeql/codeql-config.yml
@@ -0,0 +1,8 @@
name: "thumbor-aws CodeQL config"

paths:
- remotecv
- tests
paths-ignore:
- .venv
- usr/lib
11 changes: 11 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
45 changes: 45 additions & 0 deletions .github/workflows/codeql-analysis.yml
@@ -0,0 +1,45 @@
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '26 1 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: APT Update
run: sudo apt-get update -y
- name: APT Install
run: sudo apt-get install -y libjpeg-dev python3-opencv
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
setup-python-dependencies: false

- name: Install remotecv
run: make setup

- name: Set CodeQL python
run: echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,28 @@
---
name: release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
id: setup-python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install -U pip
pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
30 changes: 30 additions & 0 deletions .github/workflows/stale.yml
@@ -0,0 +1,30 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '* */6 * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove the stale label or add a comment, or this issue will be closed in 5 days. You can always re-open if you still feel this is still an issue. Tag @heynemann for more information.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 10 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information.'
close-issue-message: 'This issue was closed because it has been stale for 5 days with no activity.'
close-pr-message: 'This PR was closed because it has been stale for 10 days with no activity.'
days-before-issue-stale: 30
days-before-pr-stale: 45
days-before-issue-close: 5
days-before-pr-close: 10
exempt-draft-pr: true
operations-per-run: 1000
52 changes: 43 additions & 9 deletions .github/workflows/unittest.yaml
@@ -1,3 +1,4 @@
---
name: unittest
on:
push:
Expand All @@ -6,18 +7,51 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
name: Python ${{ matrix.python-version }}
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
id: setup-python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install apt dependencies
run: sudo apt update && sudo apt install -y libjpeg-dev python3-opencv
- name: Install pip dependencies
- name: APT Update
run: sudo apt-get update -y
- name: APT Install
run: sudo apt-get install -y libjpeg-dev python3-opencv
- name: Install remotecv
run: make setup
- run: make test
- name: Start Redis
run: make run-redis
- name: Run Unit Tests
run: make unit
env:
# Only used for satisfying boto
AWS_ACCESS_KEY_ID: foobar
AWS_SECRET_ACCESS_KEY: foobar
- name: Lint
run: make flake pylint
- name: Generate lcov
run: make coverage
- name: Coveralls
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
flag-name: run-${{ matrix.python-version }}
parallel: true
finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -14,3 +14,6 @@ tests/visual_test/build
build
*.so
.ropeproject/
coverage.lcov
.env/
.venv/
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -11,8 +11,12 @@ test: run-redis unit stop-redis
unit:
@pytest --cov=remotecv --cov-report term-missing --asyncio-mode=strict -r tests/

coverage:
@coverage report -m --fail-under=52
@coverage lcov

flake:
@flake8 --config flake8
@flake8 --config .flake8

pylint:
@pylint remotecv tests
Expand Down
6 changes: 0 additions & 6 deletions flake8

This file was deleted.

10 changes: 9 additions & 1 deletion pylintrc
Expand Up @@ -25,4 +25,12 @@ disable=
broad-except,
too-many-locals,
too-many-public-methods,
fixme
fixme,
R0801,
R0915,
C0103,
E0110,
R1732,
W1505,
protected-access

4 changes: 4 additions & 0 deletions pyproject.toml
@@ -0,0 +1,4 @@
[tool.black]
line-length = 79
target-version = ['py37']
include = '\.pyi?$'
3 changes: 2 additions & 1 deletion remotecv/healthcheck.py
@@ -1,7 +1,8 @@
from http.server import BaseHTTPRequestHandler


class HealthCheckHandler(BaseHTTPRequestHandler):

def do_GET(self):
self.send_response(200)
self.send_header("Cache-Control", "no-cache")
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg
Expand Up @@ -4,10 +4,3 @@ include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88

[flake8]
ignore = W801,E501,W605,W504,W606,W503,E203,E266
max-line-length = 88
max-complexity = 20
select = B,C,E,F,W,T4
exclude = ./.tox/*,./build/*,./docs/conf.py
5 changes: 3 additions & 2 deletions setup.py
Expand Up @@ -4,14 +4,15 @@

TESTS_REQUIREMENTS = [
"celery==4.*,>=4.4.1",
"flake8==3.*,>=3.7.9",
"pylint==2.*,>=2.4.4",
"flake8==4.*,>=4.0.1",
"pylint==2.*,>=2.13.8",
"black==22.*,>=22.1.0",
"preggy==1.*,>=1.4.4",
"pyssim==0.*,>=0.4",
"pytest==7.*,>=7.0.0",
"pytest-cov==3.*,>=3.0.0",
"pytest-asyncio==0.*,>=0.18.0",
"coverage==6.*,>=6.3.2",
]

RUNTIME_REQUIREMENTS = [
Expand Down
2 changes: 1 addition & 1 deletion tests/test_redis.py
Expand Up @@ -74,7 +74,7 @@ def test_should_return_none(self):
config.redis_mode = None

with self.assertRaises(AttributeError) as err:
client = redis_client()
redis_client()

expect(str(err.exception)).to_equal(
"redis-mode must be either single_node or sentinel"
Expand Down

0 comments on commit 84f8ee2

Please sign in to comment.