Skip to content

Commit

Permalink
Merge pull request #9 from aceberle/feature/enhance-testing-and-concu…
Browse files Browse the repository at this point in the history
…r-requests

Feature/enhance testing and concur requests
  • Loading branch information
ScholliYT authored May 16, 2021
2 parents b845620 + 812eeda commit d9f0328
Show file tree
Hide file tree
Showing 42 changed files with 2,832 additions and 128 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# All abstractmethods and abstractproperties are marked as skipped
@abstract

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError

# Skip action invocation
if __name__ == '__main__':

# don't complain if pass isn't covered
pass
63 changes: 63 additions & 0 deletions .github/workflows/python-lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Lint and Test Project

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# installing dependencies used by the project
pip install -r test-requirements.txt
- name: Python Lint with flake8
run: |
# stop the build if there are any formating or code quality failures
flake8
- name: Type Lint with mypy
run: |
# stop the build if there are any missing type declarations
mypy
- name: Unit and Coverage Test with pytest
run: |
# stop the build if there are any unit test failures
# or if our tests do not cover a significant
# amount of code
pytest -m "not integrationtest" --cov=deadseeker --cov-fail-under=95 --cov-branch --cov-report=term-missing
- name: Integration Test with pytest
run: |
# stop the build if there are any integration test failures
pytest -m "integrationtest"
- name: Set ci docker label
run: echo "CI_DOCKER_LABEL=broken-links-crawler-action:ci-$(date +%s)" >> $GITHUB_ENV
- name: Build the Docker image
uses: nick-invision/retry@v2
with:
timeout_seconds: 120
max_attempts: 3
retry_on: error
command: docker build . --file Dockerfile --tag ${{ env.CI_DOCKER_LABEL }}
- name: Test the Docker image
run: |
docker run \
-e INPUT_WEBSITE_URL="https://github.com/ScholliYT/Broken-Links-Crawler-Action" \
-e INPUT_VERBOSE="true" \
-e INPUT_MAX_RETRY_TIME=30 \
-e INPUT_MAX_RETRIES=5 \
-e INPUT_MAX_DEPTH=1 \
-e INPUT_CONNECT_LIMIT_PER_HOST=1 \
-e INPUT_INCLUDE_URL_CONTAINED='ScholliYT/Broken-Links-Crawler-Action' \
-e INPUT_EXCLUDE_URL_CONTAINED='/tree' \
-e INPUT_EXCLUDE_URL_PREFIX="mailto:,https://www.linkedin.com,https://linkedin.com" \
${{ env.CI_DOCKER_LABEL }}
34 changes: 34 additions & 0 deletions .github/workflows/python-mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Mutation Test Project

on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# installing dependencies used by the project
pip install -r test-requirements.txt
- name: Unit and Coverage Test with pytest
run: |
# stop the build if there are any unit test failures
# or if our tests do not cover a significant
# amount of code
pytest -m "not integrationtest" --cov=deadseeker --cov-fail-under=95 --cov-branch --cov-report=term-missing
- name: Mutation Test with mutmut
run: |
# stop the build if the tests that we wrote are
# not very good
mutmut run --swallow-output
145 changes: 145 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,146 @@
# vscode
.vscode

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
.mutmut-cache
.hammett-db

# mutmut report dir
html/
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: '3.9.0' # pick a git hash / tag to point to
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.812'
hooks:
- id: mypy
files: ^deadseeker/
args: [--disallow-untyped-defs]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WORKDIR /app
RUN pip3 install -r requirements.txt

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY deadseeker.py /app/deadseeker.py
COPY deadseeker /app/deadseeker/

# Code file to execute when the docker container starts up (`deadseeker.py`)
CMD [ "python", "/app/deadseeker.py" ]
CMD [ "python", "-m", "deadseeker.action" ]
Loading

0 comments on commit d9f0328

Please sign in to comment.