From 476aca96a5740ba40816c46b25397b3b40ef3a9a Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Mon, 17 Jan 2022 20:52:09 -0700 Subject: [PATCH 1/5] ci: Stop auto-committing changes as it doesn't work in external PRs --- .github/workflows/checks.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 89fd9c560..f40a80b9b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -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: @@ -77,12 +74,6 @@ 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 @@ -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: changed_files=$(git status --porcelain | wc -l) && [ changed_files != 0 ] && exit 1 - name: Cache Generated Client Dependencies uses: actions/cache@v2 with: @@ -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" From e3d7ea1611ea92956755179c274182799f054ed0 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Mon, 17 Jan 2022 20:59:34 -0700 Subject: [PATCH 2/5] ci: Regen and fix integration tests --- integration-tests/tests/conftest.py | 1 + .../test_api/test_parameters/test_post_parameters_header.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/tests/conftest.py b/integration-tests/tests/conftest.py index aebbecfc5..9cdd679fa 100644 --- a/integration-tests/tests/conftest.py +++ b/integration-tests/tests/conftest.py @@ -1,4 +1,5 @@ import pytest + from integration_tests.client import Client diff --git a/integration-tests/tests/test_api/test_parameters/test_post_parameters_header.py b/integration-tests/tests/test_api/test_parameters/test_post_parameters_header.py index 39f87d00d..2403ca417 100644 --- a/integration-tests/tests/test_api/test_parameters/test_post_parameters_header.py +++ b/integration-tests/tests/test_api/test_parameters/test_post_parameters_header.py @@ -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, From 8e2976f584dd226f9a8c1deb44c14511e661a185 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Mon, 17 Jan 2022 21:23:06 -0700 Subject: [PATCH 3/5] ci: Fix isort conflict with integration-tests --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd9bd566c..976c13666 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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/*"] From 8197313b0b275bc5f4041c71b797e5f4eb681551 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Mon, 17 Jan 2022 21:25:48 -0700 Subject: [PATCH 4/5] ci: Pin integration test server --- .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 f40a80b9b..4990ec1c2 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -79,7 +79,7 @@ jobs: 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: From 15f048feba1d5cd67451ae62b89be0daafb55d6c Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Mon, 17 Jan 2022 21:45:54 -0700 Subject: [PATCH 5/5] ci: Stop trying to hack bash to check for changes --- .github/check_for_changes.py | 10 ++++++++++ .github/workflows/checks.yml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .github/check_for_changes.py diff --git a/.github/check_for_changes.py b/.github/check_for_changes.py new file mode 100644 index 000000000..01a77d3df --- /dev/null +++ b/.github/check_for_changes.py @@ -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) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4990ec1c2..dc3875caf 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -108,7 +108,7 @@ jobs: 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: changed_files=$(git status --porcelain | wc -l) && [ changed_files != 0 ] && exit 1 + run: python .github/check_for_changes.py - name: Cache Generated Client Dependencies uses: actions/cache@v2 with: