Skip to content

ci: Test on windows #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
22 changes: 6 additions & 16 deletions end_to_end_tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down