From e68acd0ff52d2fdbbbdaa94d8fd4587e40b8958d Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Fri, 2 Jul 2021 11:31:29 -0600 Subject: [PATCH 1/6] ci: Start testing on Windows --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e2007296a..520478821 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,7 +14,7 @@ jobs: 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: From 8f5926bd1c90e039bdf73dd11b131236ddb1ce6d Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Fri, 2 Jul 2021 10:57:27 -0600 Subject: [PATCH 2/6] ci: Replace Triax Poetry install action with manual commands. --- .github/workflows/checks.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 520478821..2309f84fe 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -31,7 +31,12 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.python }}-dependencies- - name: Install dependencies - uses: triaxtec/github-actions/python/install-and-configure-poetry@main + run: | + pip install --upgrade pip + pip install poetry + poetry config virtualenvs.in-project true + poetry run pip install --upgrade pip + poetry install - name: Run Checks uses: triaxtec/github-actions/python/run-checks@main with: From 73d95932b2b1e43833d4c64f07b077a3950f8df0 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sun, 15 Aug 2021 14:09:08 -0600 Subject: [PATCH 3/6] ci: Reduce checks run duplication --- .github/workflows/checks.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2309f84fe..a2b399eef 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,12 +2,10 @@ 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: From c45d64867cee1a9d0e96cead3a03d914e48fe7a5 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sun, 15 Aug 2021 14:15:41 -0600 Subject: [PATCH 4/6] ci: Don't upgrade global pip, stop relying on any triaxtec actions. --- .github/workflows/checks.yml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a2b399eef..1fa0dd204 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -30,22 +30,33 @@ jobs: ${{ runner.os }}-${{ matrix.python }}-dependencies- - name: Install dependencies run: | - pip install --upgrade pip pip install poetry poetry config virtualenvs.in-project true poetry run pip install --upgrade pip poetry install - - name: Run Checks - uses: triaxtec/github-actions/python/run-checks@main - with: - module: openapi_python_client - - name: End to End Tests - run: poetry run pytest --cov=openapi_python_client end_to_end_tests + - 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: Run pytest + run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests - - 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 From f21dda0b81ed81ea8d087397ae4f84f471e0f7b7 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sun, 15 Aug 2021 14:21:46 -0600 Subject: [PATCH 5/6] ci: Fix Windows pip issues --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1fa0dd204..cc642a157 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -27,12 +27,12 @@ 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 run: | pip install poetry poetry config virtualenvs.in-project true - poetry run pip install --upgrade pip + poetry run python -m pip install --upgrade pip poetry install - name: Run Black From 15f61c007f687f34a12c0800b157a96918fe572e Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sun, 15 Aug 2021 14:34:48 -0600 Subject: [PATCH 6/6] test: Display difference in mismatched e2e files. --- .github/workflows/checks.yml | 2 +- end_to_end_tests/test_end_to_end.py | 22 ++++++---------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index cc642a157..2fe0a5b27 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -51,7 +51,7 @@ jobs: run: poetry run mypy --show-error-codes openapi_python_client - name: Run pytest - run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests + run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py - name: Generate coverage report shell: bash 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(