Run Integration Tests for commit main by @yuunlimm #763
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
name: Run Integration Tests | |
run-name: Run Integration Tests for commit ${{ github.event.client_payload.commit_hash || github.event.inputs.commit_hash || 'main' }} by @${{ github.actor }} | |
on: | |
repository_dispatch: | |
types: [test-txn-json-change-detected] # Custom event type to trigger the workflow | |
workflow_dispatch: | |
inputs: | |
commit_hash: | |
description: 'Commit hash to use for the dependency update' | |
required: true | |
default: 'main' | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
Integration-tests: | |
runs-on: runs-on,runner=2cpu-linux-x64,run-id=${{ github.run_id }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} # check out the code from the pull request branch: | |
# Install toml-cli using cargo | |
- name: Install toml-cli | |
run: cargo install toml-cli | |
# Show Cargo.toml Before Update | |
- name: Show Cargo.toml Before Update | |
run: cat rust/Cargo.toml | |
# Update aptos-system-utils dependency using toml-cli | |
- name: Update aptos-system-utils dependency | |
if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
COMMIT_HASH=${{ github.event.client_payload.commit_hash || github.event.inputs.commit_hash }} | |
echo "Updating aptos-system-utils dependency in Cargo.toml to use commit hash $COMMIT_HASH" | |
toml set rust/Cargo.toml workspace.dependencies.aptos-system-utils.rev "$COMMIT_HASH" > Cargo.tmp && mv Cargo.tmp rust/Cargo.toml | |
# Update aptos-indexer-test-transactions dependency using toml-cli | |
- name: Update aptos-indexer-test-transactions dependency | |
if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
COMMIT_HASH=${{ github.event.client_payload.commit_hash || github.event.inputs.commit_hash }} | |
echo "Updating aptos-indexer-test-transactions dependency in Cargo.toml to use commit hash $COMMIT_HASH" | |
toml set rust/Cargo.toml workspace.dependencies.aptos-indexer-test-transactions.rev "$COMMIT_HASH" > Cargo.tmp && mv Cargo.tmp rust/Cargo.toml | |
# Show Cargo.toml after the update | |
- name: Show Cargo.toml After Update | |
run: cat rust/Cargo.toml # Correct path to the Cargo.toml file | |
# Ensure Cargo.lock is updated with the latest dependencies | |
- name: rust setup | |
run: | | |
sudo apt update && sudo apt install libdw-dev | |
cargo update | |
working-directory: rust | |
# Cache Cargo | |
- name: Cache cargo | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# Run Integration Tests | |
- name: Run Integration Tests | |
run: | | |
# TODO: until we have more comprehensive cli parsers, we will need to run tests separately. | |
cargo test sdk_tests -- --nocapture | |
working-directory: rust/integration-tests |