Skip to content

Commit 4072c47

Browse files
authored
ci: Test on windows [#447 & #471]
* ci: Start testing on Windows * ci: Replace Triax Poetry install action with manual commands. * ci: Reduce checks run duplication * ci: Don't upgrade global pip, stop relying on any triaxtec actions. * ci: Fix Windows pip issues * test: Display difference in mismatched e2e files.
1 parent 9d991ec commit 4072c47

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

.github/workflows/checks.yml

+30-16
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ name: Run Checks
22

33
on:
44
push:
5-
branches: ["**"]
5+
branches: ["main"]
66
pull_request:
77
# The branches below must be a subset of the branches above
8-
branches: [main]
9-
schedule:
10-
- cron: '0 23 * * 2'
8+
branches: ["main"]
119

1210
jobs:
1311
test:
1412
strategy:
1513
matrix:
1614
python: [ 3.6, 3.7, 3.8, 3.9 ]
17-
os: [ ubuntu-latest, macos-latest ]
15+
os: [ ubuntu-latest, macos-latest, windows-latest ]
1816
runs-on: ${{ matrix.os }}
1917

2018
steps:
@@ -29,20 +27,36 @@ jobs:
2927
path: .venv
3028
key: ${{ runner.os }}-${{ matrix.python }}-dependencies-${{ hashFiles('**/poetry.lock') }}
3129
restore-keys: |
32-
${{ runner.os }}-${{ matrix.python }}-dependencies-
30+
${{ runner.os }}-${{ matrix.python }}-dependencies-v2
3331
- name: Install dependencies
34-
uses: triaxtec/github-actions/python/install-and-configure-poetry@main
35-
- name: Run Checks
36-
uses: triaxtec/github-actions/python/run-checks@main
37-
with:
38-
module: openapi_python_client
32+
run: |
33+
pip install poetry
34+
poetry config virtualenvs.in-project true
35+
poetry run python -m pip install --upgrade pip
36+
poetry install
37+
38+
- name: Run Black
39+
run: poetry run black . --check
40+
41+
- name: Run isort
42+
run: poetry run isort . --check
43+
44+
- name: Run flake8
45+
run: poetry run flake8 openapi_python_client
46+
47+
- name: Run safety
48+
run: poetry export -f requirements.txt | poetry run safety check --bare --stdin
49+
50+
- name: Run mypy
51+
run: poetry run mypy --show-error-codes openapi_python_client
3952

40-
- name: End to End Tests
41-
run: poetry run pytest --cov=openapi_python_client end_to_end_tests
53+
- name: Run pytest
54+
run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py
4255

43-
- name: Generate E2E Coverage
44-
run: poetry run coverage xml -o e2e-coverage.xml
56+
- name: Generate coverage report
57+
shell: bash
58+
run: poetry run coverage xml
4559

4660
- uses: codecov/codecov-action@v2
4761
with:
48-
files: ./coverage.xml,./e2e-coverage.xml
62+
files: ./coverage.xml

end_to_end_tests/test_end_to_end.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,17 @@ def _compare_directories(
3636
_, mismatches, errors = cmpfiles(record, test_subject, dc.common_files, shallow=False)
3737
mismatches = set(mismatches)
3838

39-
expected_path_mismatches = []
4039
for file_name in mismatches:
4140
mismatch_file_path = test_subject.joinpath(file_name)
42-
expected_content = expected_differences.get(mismatch_file_path)
43-
if expected_content is None:
44-
continue
41+
42+
if mismatch_file_path in expected_differences:
43+
expected_content = expected_differences[mismatch_file_path]
44+
del expected_differences[mismatch_file_path]
45+
else:
46+
expected_content = (record / file_name).read_text()
4547

4648
generated_content = (test_subject / file_name).read_text()
4749
assert generated_content == expected_content, f"Unexpected output in {mismatch_file_path}"
48-
expected_path_mismatches.append(mismatch_file_path)
49-
50-
for path_mismatch in expected_path_mismatches:
51-
matched_file_name = path_mismatch.name
52-
mismatches.remove(matched_file_name)
53-
del expected_differences[path_mismatch]
54-
55-
if mismatches:
56-
pytest.fail(
57-
f"{first_printable} and {second_printable} had differing files: {mismatches}, and errors {errors}",
58-
pytrace=False,
59-
)
6050

6151
for sub_path in dc.common_dirs:
6252
_compare_directories(

0 commit comments

Comments
 (0)