-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (66 loc) · 2.7 KB
/
python-lint-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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, workflow_dispatch]
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.2.2
- name: Install dependencies
run: |
# installing dependencies used by the project
poetry install --no-interaction --no-ansi -v
- name: Python Lint with flake8
run: |
# stop the build if there are any formating or code quality failures
poetry run flake8
- name: Type Lint with mypy
run: |
# stop the build if there are any missing type declarations
poetry run 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
poetry run 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
poetry run 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,/code_menu_contents,/hovercards/citation' \
-e INPUT_EXCLUDE_URL_PREFIX="mailto:,https://www.linkedin.com,https://linkedin.com" \
-e INPUT_EXCLUDE_URL_SUFFIX=".zip" \
--workdir="/opt/" \
${{ env.CI_DOCKER_LABEL }}