forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
559 changed files
with
16,239 additions
and
2,410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Rust Targeted Unit Tests | ||
description: Runs only the targeted rust unit tests | ||
inputs: | ||
GIT_CREDENTIALS: | ||
description: "Optional credentials to pass to git. Useful if you need to pull private repos for dependencies" | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# The source code must be checked out by the workflow that invokes this action. | ||
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main | ||
with: | ||
GIT_CREDENTIALS: ${{ inputs.GIT_CREDENTIALS }} | ||
|
||
# Install nextest | ||
- uses: taiki-e/[email protected] | ||
with: | ||
tool: nextest | ||
|
||
# Run a postgres database | ||
- name: Run postgres database | ||
run: docker run --detach -p 5432:5432 cimg/postgres:14.2 | ||
shell: bash | ||
|
||
# Output the changed files | ||
- name: Output the changed files | ||
run: cargo x changed-files -vv | ||
shell: bash | ||
|
||
# Output the affected packages | ||
- name: Output the affected packages | ||
run: cargo x affected-packages -vv | ||
shell: bash | ||
|
||
# Run only the targeted rust unit tests | ||
- name: Run only the targeted unit tests | ||
run: | | ||
cargo x targeted-unit-tests -vv --profile ci --cargo-profile ci --locked --no-fail-fast --retries 3 | ||
shell: bash | ||
env: | ||
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres | ||
RUST_MIN_STACK: "4297152" | ||
MVP_TEST_ON_CI: "true" | ||
SOLC_EXE: /home/runner/bin/solc | ||
Z3_EXE: /home/runner/bin/z3 | ||
CVC5_EXE: /home/runner/bin/cvc5 | ||
DOTNET_ROOT: /home/runner/.dotnet | ||
BOOGIE_EXE: /home/runner/.dotnet/tools/boogie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ runs: | |
using: composite | ||
steps: | ||
# The source code must be checkout out by the workflow that invokes this action. | ||
|
||
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main | ||
with: | ||
GIT_CREDENTIALS: ${{ inputs.GIT_CREDENTIALS }} | ||
|
@@ -31,7 +30,7 @@ runs: | |
- uses: taiki-e/[email protected] | ||
with: | ||
tool: nextest | ||
|
||
# Install buildkite-test-collector | ||
- name: Install buildkite-test-collector | ||
run: cargo install buildkite-test-collector | ||
|
@@ -45,8 +44,9 @@ runs: | |
# Run the rust unit tests | ||
- name: Run all unit tests | ||
run: | | ||
NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 cargo nextest run --profile ci --cargo-profile ci --locked --workspace --exclude smoke-test --exclude aptos-testcases --retries 3 --no-fail-fast --message-format libtest-json > nextest_output.json | ||
NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 cargo nextest run --profile ci --cargo-profile ci --locked --workspace --exclude smoke-test --exclude aptos-testcases --retries 3 --no-fail-fast --message-format libtest-json > nextest_output.json || python3 .github/actions/rust-unit-tests/nextest_summary.py nextest_output.json "$GITHUB_STEP_SUMMARY" -f | ||
buildkite-test-collector < nextest_output.json || echo "Warning: buildkite-test-collector encountered an error" | ||
python3 .github/actions/rust-unit-tests/nextest_summary.py nextest_output.json "$GITHUB_STEP_SUMMARY" || echo "summary generation had an error" | ||
rm nextest_output.json | ||
shell: bash | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
|
||
# how many failed tests to name before it's too many ... | ||
FAIL_HEAD_LINES = 20 | ||
|
||
def main(): | ||
ap = argparse.ArgumentParser() | ||
ap.add_argument('nextest_json') | ||
ap.add_argument('summary_out_path') | ||
ap.add_argument('-f', '--fail', default=False, action='store_true') | ||
args = ap.parse_args() | ||
|
||
badlines = 0 | ||
eventCounts = {} | ||
failnames = [] | ||
flakey = [] | ||
with open(args.nextest_json, 'rt') as fin: | ||
for line in fin: | ||
try: | ||
rec = json.loads(line) | ||
except Exception as e: | ||
badlines += 1 | ||
if badlines < 10: | ||
print(e) | ||
continue | ||
rectype = rec.get('type') | ||
if rectype != 'test': | ||
continue | ||
event = rec.get('event') | ||
if event == 'started': | ||
continue | ||
eventCounts[event] = eventCounts.get(event, 0) + 1 | ||
if event == 'failed': | ||
failnames.append(rec.get('name', '_')) | ||
if event == 'ok': | ||
testname = rec.get('name', '_') | ||
if '#' in testname: | ||
# flakey test passed on retry | ||
flakey.append(rec) | ||
with open(args.summary_out_path, 'at') as fout: | ||
rows = [] | ||
for event in ('ok', 'ignored', 'failed'): | ||
ec = eventCounts.pop(event, 0) | ||
style = "" | ||
if event == 'failed': | ||
style = ' style="font-weight:bold;font-size:120%;color:#f00;"' | ||
rows.append(f'<tr{style}><td>{ec}</td><td>{event}</td></tr>') | ||
for event, ec in eventCounts.items(): | ||
rows.append(f'<tr><td>{ec}</td><td>{event}</td></tr>') | ||
if badlines != 0: | ||
rows.append(f'<tr><td>{badlines}</td><td>bad lines</td></tr>') | ||
fout.write('<table>' + ''.join(rows) + '</table>\n\n') | ||
if failnames: | ||
failnames.sort() | ||
failshow = failnames | ||
if len(failnames) > FAIL_HEAD_LINES: | ||
failshow = failnames[:FAIL_HEAD_LINES] | ||
fout.write('## Failed\n\n') | ||
for fn in failshow: | ||
fout.write(f' {fn}\n') | ||
if len(failnames) > FAIL_HEAD_LINES: | ||
fout.write(f' ... and {len(failnames)-FAIL_HEAD_LINES} more\n') | ||
fout.write('\n') | ||
elif flakey: | ||
flakeshow = flakey | ||
if len(flakeshow) > FAIL_HEAD_LINES: | ||
flakeshow = flakeshow[:FAIL_HEAD_LINES] | ||
fout.write("## Flakey\n\n") | ||
for rec in flakeshow: | ||
name = rec['name'] | ||
etime = rec.get('exec_time', '') | ||
fout.write(f" {name} ({etime})\n") | ||
if len(flakey) > FAIL_HEAD_LINES: | ||
fout.write(f" ... and {len(flakey)-FAIL_HEAD_LINES} more\n") | ||
fout.write("\n") | ||
if failnames: | ||
print(f"{len(failnames)} FAILING tests:") | ||
print("\n".join(failnames)) | ||
print(f"{len(failnames)} FAILING tests") | ||
if eventCounts.get('failed',0) != 0: | ||
sys.exit(1) | ||
if args.fail: | ||
sys.exit(1) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.