Skip to content

ci: Stop auto-committing changes as it doesn't work in external PRs #567

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 5 commits into from
Jan 18, 2022
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
10 changes: 10 additions & 0 deletions .github/check_for_changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import subprocess

output = subprocess.run(["git", "status", "--porcelain"], capture_output=True, check=True).stdout

if output == b"":
# No changes
exit(0)

print(output)
exit(1)
16 changes: 3 additions & 13 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ jobs:
- name: Run pylint
run: poetry run pylint openapi_python_client

- name: Regenerate Golden Record
run: poetry run task regen_e2e

- 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 --basetemp=tests/tmp
env:
Expand All @@ -77,18 +74,12 @@ jobs:
with:
files: ./coverage.xml

- uses: stefanzweifel/git-auto-commit-action@v4
if: runner.os == 'Linux'
with:
commit_message: "chore: Regenerate E2E Golden Record"
file_pattern: end_to_end_tests/golden-record end_to_end_tests/custom-templates-golden-record

integration:
name: Integration Tests
runs-on: ubuntu-latest
services:
openapi-test-server:
image: ghcr.io/openapi-generators/openapi-test-server:latest
image: ghcr.io/openapi-generators/openapi-test-server:0.0.1
ports:
- "3000:3000"
steps:
Expand Down Expand Up @@ -116,6 +107,8 @@ jobs:
- name: Regenerate Integration Client
run: |
poetry run openapi-python-client update --url http://localhost:3000/openapi.json --config integration-tests-config.yaml
- name: Check for any file changes
run: python .github/check_for_changes.py
- name: Cache Generated Client Dependencies
uses: actions/cache@v2
with:
Expand All @@ -133,6 +126,3 @@ jobs:
run: |
cd integration-tests
poetry run pytest
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: Regenerate Integration Client"
1 change: 1 addition & 0 deletions integration-tests/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.client import Client


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test(client: Client) -> None:
)

parsed = response.parsed
assert parsed is not None, f"{response.status_code}: {response.content}"
assert parsed is not None, f"{response.status_code}: {response.content!r}"
assert isinstance(
parsed,
PostParametersHeaderResponse200,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exclude = '''
[tool.isort]
line_length = 120
profile = "black"
skip = [".venv", "tests/test_templates"]
skip = [".venv", "tests/test_templates", "integration-tests"]

[tool.coverage.run]
omit = ["openapi_python_client/templates/*"]
Expand Down