diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e2007296a..2fe0a5b27 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,19 +2,17 @@ name: Run Checks on: push: - branches: ["**"] + branches: ["main"] pull_request: # The branches below must be a subset of the branches above - branches: [main] - schedule: - - cron: '0 23 * * 2' + branches: ["main"] jobs: test: strategy: matrix: python: [ 3.6, 3.7, 3.8, 3.9 ] - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: @@ -29,20 +27,36 @@ jobs: path: .venv key: ${{ runner.os }}-${{ matrix.python }}-dependencies-${{ hashFiles('**/poetry.lock') }} restore-keys: | - ${{ runner.os }}-${{ matrix.python }}-dependencies- + ${{ runner.os }}-${{ matrix.python }}-dependencies-v2 - name: Install dependencies - uses: triaxtec/github-actions/python/install-and-configure-poetry@main - - name: Run Checks - uses: triaxtec/github-actions/python/run-checks@main - with: - module: openapi_python_client + run: | + pip install poetry + poetry config virtualenvs.in-project true + poetry run python -m pip install --upgrade pip + poetry install + + - name: Run Black + run: poetry run black . --check + + - name: Run isort + run: poetry run isort . --check + + - name: Run flake8 + run: poetry run flake8 openapi_python_client + + - name: Run safety + run: poetry export -f requirements.txt | poetry run safety check --bare --stdin + + - name: Run mypy + run: poetry run mypy --show-error-codes openapi_python_client - - name: End to End Tests - run: poetry run pytest --cov=openapi_python_client end_to_end_tests + - name: Run pytest + run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py - - name: Generate E2E Coverage - run: poetry run coverage xml -o e2e-coverage.xml + - name: Generate coverage report + shell: bash + run: poetry run coverage xml - uses: codecov/codecov-action@v2 with: - files: ./coverage.xml,./e2e-coverage.xml + files: ./coverage.xml diff --git a/end_to_end_tests/test_end_to_end.py b/end_to_end_tests/test_end_to_end.py index 072dd48ad..6ad49fcb9 100644 --- a/end_to_end_tests/test_end_to_end.py +++ b/end_to_end_tests/test_end_to_end.py @@ -36,27 +36,17 @@ def _compare_directories( _, mismatches, errors = cmpfiles(record, test_subject, dc.common_files, shallow=False) mismatches = set(mismatches) - expected_path_mismatches = [] for file_name in mismatches: mismatch_file_path = test_subject.joinpath(file_name) - expected_content = expected_differences.get(mismatch_file_path) - if expected_content is None: - continue + + if mismatch_file_path in expected_differences: + expected_content = expected_differences[mismatch_file_path] + del expected_differences[mismatch_file_path] + else: + expected_content = (record / file_name).read_text() generated_content = (test_subject / file_name).read_text() assert generated_content == expected_content, f"Unexpected output in {mismatch_file_path}" - expected_path_mismatches.append(mismatch_file_path) - - for path_mismatch in expected_path_mismatches: - matched_file_name = path_mismatch.name - mismatches.remove(matched_file_name) - del expected_differences[path_mismatch] - - if mismatches: - pytest.fail( - f"{first_printable} and {second_printable} had differing files: {mismatches}, and errors {errors}", - pytrace=False, - ) for sub_path in dc.common_dirs: _compare_directories(