b_t5-execution_chain: Ethereum 1.0 / Legacy Chain Associated Methods and Data Models #219
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: Rust Playground CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
name: Build and Test All Tutorials | |
runs-on: ubuntu-latest | |
services: | |
# refer to: https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/creating-postgresql-service-containers | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_DB: defaultdb | |
POSTGRES_PASSWORD: admin | |
POSTGRES_USER: admin | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: "1.82.0" | |
override: true | |
- name: Check PostgreSQL SetUp OK | |
run: | | |
echo "Check PostgreSQL SetUp OK" | |
ps -ef | grep postgres | |
- name: Build and Test tutorial-1 | |
working-directory: ./tutorial-1 | |
env: | |
RUSTFLAGS: "-Awarnings" # Suppress warnings | |
run: | | |
cargo build --verbose | |
cargo test --verbose -- --nocapture | |
- name: Build and Test tutorial-2 | |
working-directory: ./tutorial-2 | |
env: | |
RUSTFLAGS: "-Awarnings" # Suppress warnings | |
run: | | |
cargo build --verbose | |
cargo test --verbose -- --nocapture | |
- name: Build and Test tutorial-3 | |
working-directory: ./tutorial-3 | |
env: | |
RUSTFLAGS: "-Awarnings" # Suppress warnings | |
run: | | |
cargo build --verbose | |
cargo test --verbose -- --nocapture | |
- name: Build and Test tutorial-5 | |
working-directory: ./tutorial-5 | |
env: | |
RUSTFLAGS: "-Awarnings" # Suppress warnings | |
DATABASE_URL: "postgresql://admin:admin@localhost:5432/defaultdb" # Set database URL for tests | |
GETH_URL: "ws://localhost:8546" # Set local setup Geth Endpoint | |
run: | | |
echo "Install dependencies for Geth on local" | |
sudo apt update | |
sudo apt install -y software-properties-common | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt update | |
sudo apt install -y geth | |
echo "Start Geth in the background with necessary flags" | |
nohup geth --http --http.api "eth,web3,net" --ws --ws.api "eth,web3,net" --syncmode snap --ws.addr 0.0.0.0 --ws.port 8546 > geth.log 2>&1 & | |
sleep 30 # Wait for Geth to fully start | |
echo "Run Tests to Interact with Geth" | |
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545 | |
echo "Install sqlx... " | |
cargo install sqlx-cli --no-default-features --features postgres | |
echo "Migrate via sqlx ..." | |
sqlx migrate run --database-url postgres://admin:admin@localhost:5432/defaultdb | |
echo "cargo sqlx prepare " | |
cargo sqlx prepare | |
echo "Begin cargo build in tutorial-5" | |
cargo build --verbose | |
echo "Begin cargo test in tutorial-5" | |
cargo test --verbose -- --nocapture | |
echo "Shutdown Geth Node" | |
pkill geth | |
- name: Build and Test tutorial-6 | |
working-directory: ./tutorial-6 | |
run: | | |
echo "cargo build" | |
cargo build --verbose | |
echo "cargo test" | |
cargo test --verbose -- --nocapture |