Run Integration Tests for commit main by @yuunlimm #530
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: ubuntu-latest # Ensure the correct runner is used | |
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: Update Dependencies | |
run: cargo update | |
working-directory: rust | |
- name: Install Dependencies and Run Linter | |
uses: ./.github/actions/dep_install_and_lint | |
with: | |
working-directory: rust | |
# Run Integration Tests | |
- name: Run Integration Tests | |
run: cargo test --manifest-path integration-tests/Cargo.toml | |
working-directory: rust |