Skip to content

Commit 84d7783

Browse files
committed
Make tools/ci-scripts/codegen-diff-revisions.py fault tolerant
1 parent 049287d commit 84d7783

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/ci-scripts/codegen-diff-revisions.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
#
1515
# ```
1616
# $ cd test/smithy-rs
17-
# $ ../../smithy-rs/tools/codegen-diff-revisions.py . <some commit hash to diff against>
17+
# $ ../../smithy-rs/tools/ci-scripts/codegen-diff-revisions.py . <some commit hash to diff against>
1818
# ```
1919
#
2020
# It will diff the generated code from HEAD against any commit hash you feed it. If you want to test
2121
# a specific range, change the HEAD of the test repository.
2222
#
23-
# This script requires `diff2html-cli` to be installed from NPM:
23+
# This script requires `difftags` to be installed from `tools/ci-build/difftags`:
2424
# ```
25-
# $ npm install -g [email protected]
25+
# $ cargo install --path tools/ci-build/difftags
2626
# ```
2727
# Make sure the local version matches the version referenced from the GitHub Actions workflow.
2828

2929
import os
3030
import sys
3131
import subprocess
32-
import tempfile
3332
import shlex
3433

3534

@@ -94,15 +93,15 @@ def generate_and_commit_generated_code(revision_sha):
9493

9594
# Generate code
9695
run("./gradlew --rerun-tasks aws:sdk:assemble codegen-client-test:assemble codegen-server-test:assemble")
97-
run("cd rust-runtime/aws-smithy-http-server-python/examples && make build", shell=True)
96+
run("cd rust-runtime/aws-smithy-http-server-python/examples && make build", shell=True, check=False)
9897

9998
# Move generated code into codegen-diff/ directory
10099
run(f"rm -rf {OUTPUT_PATH}")
101100
run(f"mkdir {OUTPUT_PATH}")
102101
run(f"mv aws/sdk/build/aws-sdk {OUTPUT_PATH}/")
103102
run(f"mv codegen-client-test/build/smithyprojections/codegen-client-test {OUTPUT_PATH}/")
104103
run(f"mv codegen-server-test/build/smithyprojections/codegen-server-test {OUTPUT_PATH}/")
105-
run(f"mv rust-runtime/aws-smithy-http-server-python/examples/pokemon-service-server-sdk/ {OUTPUT_PATH}/codegen-server-test-python/")
104+
run(f"mv rust-runtime/aws-smithy-http-server-python/examples/pokemon-service-server-sdk/ {OUTPUT_PATH}/codegen-server-test-python/", check=False)
106105

107106
# Clean up the SDK directory
108107
run(f"rm -f {OUTPUT_PATH}/aws-sdk/versions.toml")
@@ -201,10 +200,10 @@ def eprint(*args, **kwargs):
201200

202201

203202
# Runs a shell command
204-
def run(command, shell=False):
203+
def run(command, shell=False, check=True):
205204
if not shell:
206205
command = shlex.split(command)
207-
subprocess.run(command, stdout=sys.stderr, stderr=sys.stderr, shell=shell, check=True)
206+
subprocess.run(command, stdout=sys.stderr, stderr=sys.stderr, shell=shell, check=check)
208207

209208

210209
# Returns the output from a shell command. Bails if the command failed

0 commit comments

Comments
 (0)