Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
alex4506 authored Apr 11, 2024
2 parents 4571ddc + 462ec0b commit 3b1ef7b
Show file tree
Hide file tree
Showing 559 changed files with 16,239 additions and 2,410 deletions.
5 changes: 2 additions & 3 deletions .github/actions/docker-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ inputs:
required: false
GCP_AUTH_DURATION:
description: "Duration of GCP auth token in seconds"
type: int
# setting this to 1.5h since sometimes docker builds (special performance
# builds etc.) take that long. Default is 1h.
default: 5400
default: "5400"

outputs:
CLOUDSDK_AUTH_ACCESS_TOKEN:
Expand Down Expand Up @@ -78,7 +77,7 @@ runs:

- id: auth
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
uses: "google-github-actions/auth@v2"
with:
create_credentials_file: false
token_format: "access_token"
Expand Down
49 changes: 49 additions & 0 deletions .github/actions/rust-targeted-unit-tests/action.yaml
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
6 changes: 3 additions & 3 deletions .github/actions/rust-unit-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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:
Expand Down
90 changes: 90 additions & 0 deletions .github/actions/rust-unit-tests/nextest_summary.py
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()
6 changes: 3 additions & 3 deletions .github/workflows/cargo-metadata-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
cargo-metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- id: auth
uses: "google-github-actions/auth@v1"
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
- uses: "google-github-actions/setup-gcloud@v1"
- uses: "google-github-actions/setup-gcloud@v2"
- shell: bash
run: |
cargo metadata --all-features | gsutil cp - gs://aptos-core-cargo-metadata-public/metadata-${{ github.sha }}.json
2 changes: 1 addition & 1 deletion .github/workflows/copy-images-to-dockerhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
# Run on a machine with more local storage for large docker images
runs-on: medium-perf-docker-with-local-ssd
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-update-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/forge-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
outputs:
IMAGE_TAG: ${{ steps.get-docker-image-tag.outputs.IMAGE_TAG }}
BRANCH: ${{ steps.determine-test-branch.outputs.BRANCH }}
BRANCH_HASH: ${{ steps.hash-branch.outputs.BRANCH_HASH }}
steps:
- uses: actions/checkout@v3

Expand All @@ -69,6 +70,20 @@ jobs:
echo "BRANCH=${{ inputs.GIT_SHA }}" >> $GITHUB_OUTPUT
fi
# Use the branch hash instead of the full branch name to stay under kubernetes namespace length limit
- name: Hash the branch
id: hash-branch
run: |
# If BRANCH is empty, default to "main"
if [ -z "${{ steps.determine-test-branch.outputs.BRANCH }}" ]; then
BRANCH="main"
else
BRANCH="${{ steps.determine-test-branch.outputs.BRANCH }}"
fi
# Hashing the branch name
echo "BRANCH_HASH=$(echo -n "$BRANCH" | sha256sum | cut -c1-10)" >> $GITHUB_OUTPUT
- uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main
with:
cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork
Expand Down Expand Up @@ -110,7 +125,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-max-load-long-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-max-load-long-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 7200 # Run for 2 hours
FORGE_TEST_SUITE: realistic_env_max_load_large
POST_TO_SLACK: true
Expand All @@ -122,7 +137,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-load-sweep-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-load-sweep-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 1500 # Run for 25 minutes (5 tests, each for 300 seconds)
FORGE_TEST_SUITE: realistic_env_load_sweep
POST_TO_SLACK: true
Expand All @@ -134,7 +149,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-workload-sweep-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-workload-sweep-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 1600 # Run for 26 minutes (4 tests, each for 400 seconds)
FORGE_TEST_SUITE: realistic_env_workload_sweep
POST_TO_SLACK: true
Expand All @@ -146,7 +161,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-graceful-overload-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-env-graceful-overload-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 1200 # Run for 20 minutes
FORGE_TEST_SUITE: realistic_env_graceful_overload
POST_TO_SLACK: true
Expand All @@ -158,7 +173,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-network-tuned-for-throughput-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-realistic-network-tuned-for-throughput-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 900 # Run for 15 minutes
FORGE_TEST_SUITE: realistic_network_tuned_for_throughput
FORGE_ENABLE_PERFORMANCE: true
Expand All @@ -173,7 +188,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-consensus-stress-test-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-consensus-stress-test-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 2400 # Run for 40 minutes
FORGE_TEST_SUITE: consensus_stress_test
POST_TO_SLACK: true
Expand All @@ -185,7 +200,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-workload-mix-test-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-workload-mix-test-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 900 # Run for 15 minutes
FORGE_TEST_SUITE: workload_mix
POST_TO_SLACK: true
Expand All @@ -197,7 +212,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-continuous-e2e-single-vfn-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-continuous-e2e-single-vfn-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 480 # Run for 8 minutes
FORGE_TEST_SUITE: single_vfn_perf
POST_TO_SLACK: true
Expand All @@ -209,7 +224,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-haproxy-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-haproxy-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 600 # Run for 10 minutes
FORGE_ENABLE_HAPROXY: true
FORGE_TEST_SUITE: realistic_env_max_load
Expand All @@ -222,7 +237,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-fullnode-reboot-stress-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-fullnode-reboot-stress-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 1800 # Run for 30 minutes
FORGE_TEST_SUITE: fullnode_reboot_stress_test
POST_TO_SLACK: true
Expand All @@ -235,7 +250,7 @@ jobs:
uses: aptos-labs/aptos-core/.github/workflows/workflow-run-forge.yaml@main
secrets: inherit
with:
FORGE_NAMESPACE: forge-compat-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-compat-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 300 # Run for 5 minutes
# This will upgrade from testnet branch to the latest main
FORGE_TEST_SUITE: compat
Expand All @@ -252,7 +267,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-changing-working-quorum-test-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-changing-working-quorum-test-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 1200 # Run for 20 minutes
FORGE_TEST_SUITE: changing_working_quorum_test
POST_TO_SLACK: true
Expand All @@ -265,7 +280,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-changing-working-quorum-test-high-load-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-changing-working-quorum-test-high-load-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 900 # Run for 15 minutes
FORGE_TEST_SUITE: changing_working_quorum_test_high_load
POST_TO_SLACK: true
Expand All @@ -279,7 +294,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-pfn-const-tps-with-realistic-env-${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-pfn-const-tps-with-realistic-env-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
FORGE_RUNNER_DURATION_SECS: 900 # Run for 15 minutes
FORGE_TEST_SUITE: pfn_const_tps_with_realistic_env
POST_TO_SLACK: true
Loading

0 comments on commit 3b1ef7b

Please sign in to comment.