Skip to content

Merge branch 'dev' into scx1332/ggas #1450

Merge branch 'dev' into scx1332/ggas

Merge branch 'dev' into scx1332/ggas #1450

Workflow file for this run

name: CI
on:
push:
workflow_dispatch:
schedule:
- cron: "42 3 * * *"
jobs:
fmt_and_clippy:
name: Fmt and clippy
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Check generation
run: |
cd crates/erc20_rpc_pool/src/rpc_pool
python gen_methods.py
git diff --exit-code
- name: Fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Clippy all
run: cargo clippy --all-targets --all-features --all -- -D warnings
erc20_processor:
name: ERC20 processor build only
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Build erc20 processor
run: cargo build --profile=release-lto
build_tests_and_cache:
name: Build and cache all tests
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
profile: [release-fast, release-lto, dev]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-${{ matrix.profile }}"
- name: Build tests
run: cargo test --profile=${{ matrix.profile }} --test custom_long --no-run
library_tests:
name: Payment lib unit test run
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Run tests
run: cargo test -p erc20_payment_lib --profile=release-fast
payment_tests:
name: Payment tests (basic + multi)
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Build tests
run: cargo test --test docker_01_basic --test docker_04_multi --profile=release-fast --no-run
- name: Run tests (docker_01_basic)
run: cargo test --test docker_01_basic --profile=release-fast -- --test-threads=10
- name: Run tests (docker_04_multi)
run: cargo test --test docker_04_multi --profile=release-fast -- --test-threads=10
payment_tests_2:
name: Payment tests (errors)
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Build tests
run: cargo test --test docker_02_errors --profile=release-fast --no-run
- name: Run tests (docker_02_errors)
run: cargo test --test docker_02_errors --profile=release-fast -- --test-threads=10
payment_tests_pool:
name: Payment tests (rpc pool)
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Build tests
run: cargo test --test docker_05_rpc_pool --profile=release-fast --no-run
- name: Run tests (docker_05_rpc_pool)
run: cargo test --test docker_05_rpc_pool --profile=release-fast -- --test-threads=10
payment_tests_multi:
name: Payment tests (multi)
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Build tests
run: cargo test --test docker_03_problems --profile=release-fast --no-run
- name: Run tests (docker_03_problems)
run: cargo test --test docker_03_problems --profile=release-fast -- --test-threads=10
test_faucet_holesky:
name: Test Holesky faucet
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "dev-build-cache"
- name: Build
run: cargo build
- name: Run tests (faucet)
run: cargo run -- generate-key -n 1 > .env
- name: Check if balance is 0
run: |
[ $(cargo run -- balance -c holesky | jq -r '.[] | .gasDecimal') == "0" ]
[ $(cargo run -- balance -c holesky | jq -r '.[] | .tokenDecimal') == "0" ]
- name: Get ETH from faucet
run: cargo run -- get-dev-eth -c holesky
- name: Check ETH balance after getting funds from faucet (should be 0.01)
run: |
sleep 60 # give time for the blockchain to propagate info about the transaction
[ $(cargo run -- balance -c holesky | jq -r '.[] | .gasDecimal') == "0.01" ]
- name: Mint tokens
run: |
cargo run -- mint-test-tokens -c holesky
cargo run -- run
- name: Check token balance
run: |
[ $(cargo run -- balance -c holesky | jq -r '.[] | .tokenDecimal') == "1000" ]
- name: Transfer 166.6 GLM tokens
run: |
cargo run -- transfer -c holesky --recipient 0x5b984629E2Cc7570cBa7dD745b83c3dD23Ba6d0f --token glm --amount 166.6
cargo run -- run
- name: Transfer all GLM tokens
run: |
cargo run -- transfer -c holesky --recipient 0x5b984629E2Cc7570cBa7dD745b83c3dD23Ba6d0f --token glm --all
cargo run -- run
- name: Check token balance zero
run: |
[ $(cargo run -- balance -c holesky | jq -r '.[] | .tokenDecimal') == "0" ]
- name: Transfer all left ETH tokens
run: |
cargo run -- transfer -c holesky --recipient 0x5b984629E2Cc7570cBa7dD745b83c3dD23Ba6d0f --token eth --all
cargo run -- run
payment_tests_custom:
name: Payment tests (custom)
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-cache-release-fast"
save-if: false
- name: Build tests
run: cargo test --profile=release-fast --no-run
- name: Run test custom (200 transfers)
run: cargo test --profile=release-fast --test custom_long -- --test-threads=1
env:
ERC20_TESTS_USE_DISK_DB: 1
ERC20_TESTS_OVERRIDE_DB_NAME: erc20lib.sqlite
ERC20_LIB_SQLITE_JOURNAL_MODE: wal
ERC20_TEST_RECEIVER_POOL_SIZE: 300
ERC20_TEST_MAX_IN_TX: 15
ERC20_TEST_TRANSFER_COUNT: 200
ERC20_TEST_TRANSFER_INTERVAL: 0.1
- name: Reopen db cleaning wal logs
run: cargo run --profile=release-fast -- --sqlite-db-file erc20lib.sqlite --sqlite-journal delete cleanup
- uses: actions/upload-artifact@v3
with:
name: erc20lib_custom
path: erc20lib.sqlite