-
Notifications
You must be signed in to change notification settings - Fork 82
81 lines (69 loc) · 3.16 KB
/
integration-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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