diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml new file mode 100644 index 00000000..6363c7f9 --- /dev/null +++ b/.github/actions/lint/action.yml @@ -0,0 +1,23 @@ +name: Lint +description: Lints the codebase with black, isort, pyflakes, and mypy + +runs: + using: composite + steps: + - uses: ./.github/actions/init + + - name: Linting with black + run: black --check mnamer tests + shell: sh + + - name: Linting isort + run: isort --check-only mnamer tests + shell: sh + + - name: Linting pyflakes + run: pyflakes mnamer tests + shell: sh + + - name: Linting mypy + run: mypy mnamer tests + shell: sh diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 00000000..623eae0d --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,46 @@ +name: Test +description: Tests the codebase with pytest + +runs: + using: composite + steps: + - uses: ./.github/actions/init + + - name: Running Local Unit Tests + run: >- + python -m pytest + -m local + --durations=10 + --cov=./ + --cov-append + --cov-report=term-missing + --cov-report=xml + shell: sh + + - name: Running Network Unit Tests + run: >- + python -m pytest + -m network + --reruns 3 + --durations=10 + --cov=./ + --cov-append + --cov-report=term-missing + --cov-report=xml + shell: sh + + - name: Running End to End Tests + run: >- + python -m pytest + -m e2e + --reruns 3 + --durations=10 + --cov=./ + --cov-append + --cov-report=term-missing + --cov-report=xml + shell: sh + + - name: Reporting Coverage Statistics + uses: codecov/codecov-action@v1 + if: success() && github.ref == 'refs/heads/main' diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d7b56a7a..28fe2693 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -3,26 +3,16 @@ name: pr on: pull_request jobs: - - lint: # ------------------------------------------------------------------------------ + lint: runs-on: ubuntu-latest steps: - - uses: ./.github/actions/init - - - name: Linting with black - run: black --check mnamer tests - - - name: Linting isort - run: isort --check-only mnamer tests + - uses: actions/checkout@v3 + - uses: ./.github/actions/lint - - name: Linting mypy - run: mypy mnamer - - test: # ------------------------------------------------------------------------------ + test: runs-on: ubuntu-latest - steps: - - uses: ./.github/actions/init - - run: >- - python -m pytest -m 'not tvdb' + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/test diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d41f2bb7..56a9687c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,108 +3,44 @@ name: push on: push: schedule: - - cron: "0 8 * * 1" # Mondays at 8am + - cron: "0 8 * * 1" # mondays at 8am jobs: - build: # ----------------------------------------------------------------------------- + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: { fetch-depth: 0 } + - uses: ./.github/actions/lint - - uses: ./.github/actions/init - - - name: Attempting build - run: python3 -m build --sdist --wheel --no-isolation - - - run: python3 -m mnamer --version - - lint: # ------------------------------------------------------------------------------ + test: runs-on: ubuntu-latest - needs: build steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/init - - - name: Linting with black - run: black --check mnamer tests + - uses: ./.github/actions/test - - name: Linting isort - run: isort --check-only mnamer tests - - - name: Linting pyflakes - run: pyflakes mnamer tests - - - name: Linting mypy - run: mypy mnamer tests - - test: # ------------------------------------------------------------------------------ + publish: runs-on: ubuntu-latest - needs: build - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/init - - name: Running Local Unit Tests - run: >- - python -m pytest - -m local - --durations=10 - --cov=./ - --cov-append - --cov-report=term-missing - --cov-report=xml - - - name: Running Network Unit Tests - run: >- - python -m pytest - -m network - --reruns 3 - --durations=10 - --cov=./ - --cov-append - --cov-report=term-missing - --cov-report=xml - - - name: Running End to End Tests - run: >- - python -m pytest - -m e2e - --reruns 3 - --durations=10 - --cov=./ - --cov-append - --cov-report=term-missing - --cov-report=xml - - - name: Reporting Coverage Statistics - uses: codecov/codecov-action@v1 - if: >- - success() - && github.event_name == 'push' - && github.ref == 'refs/heads/main' - - publish: # --------------------------------------------------------------------------- - runs-on: ubuntu-latest if: >- success() && github.event_name == 'push' && github.ref == 'refs/heads/main' needs: - - build - lint - test steps: - - uses: actions/checkout@v3 - with: { fetch-depth: 0 } - - uses: ./.github/actions/init + - name: Building + run: python3 -m build --sdist --wheel --no-isolation + + - name: Reporting Version + run: python3 -m mnamer --version + - name: Uploading to PyPI run: >- twine upload diff --git a/Dockerfile b/Dockerfile index 036de0d0..b93e4670 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM python:alpine -ARG MNAMER_VERSION=2.4.2 +ARG MNAMER_VERSION=2.5.2 ARG UID=1000 ARG GID=1000 RUN addgroup mnamer -g $GID diff --git a/tests/e2e/test_moving.py b/tests/e2e/test_moving.py index 6dcb83fa..edf004af 100644 --- a/tests/e2e/test_moving.py +++ b/tests/e2e/test_moving.py @@ -6,7 +6,7 @@ pytestmark = [ pytest.mark.e2e, - pytest.mark.flaky(reruns=1), + pytest.mark.flaky(reruns=2), ]