add go test engine with simply test to be added to ci #18
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: CI Workflow | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Install Kurtosis CLI | |
- name: Install Kurtosis CLI | |
run: | | |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | |
sudo apt update | |
sudo apt install kurtosis-cli | |
kurtosis version | |
# Step 4: Spin up Kurtosis Devnet | |
- name: Deploy Kurtosis Devnet | |
run: | | |
kurtosis run --enclave cdk github.com/0xPolygon/[email protected] \ | |
--args-file=https://raw.githubusercontent.com/0xPolygon/kurtosis-cdk/refs/heads/main/.github/tests/combinations/fork11-new-cdk-stack-rollup.yml | |
# Step 5: Extract RPC URL from Kurtosis Service | |
- name: Get Kurtosis RPC URL | |
id: grab-url | |
run: | | |
# Query Kurtosis for service details | |
SERVICE_INFO=$(kurtosis service inspect cdk cdk-erigon-rpc-001) | |
# Extract only the HTTP RPC URL (ignore ws-rpc lines) | |
RPC_URL=$(echo "$SERVICE_INFO" | grep -E '^ *rpc:' | awk -F'-> ' '{print $2}' | awk '{print $1}') | |
# Debug: Print the extracted RPC_URL for troubleshooting | |
echo "Extracted RPC_URL: $RPC_URL" | |
# Escape special characters in RPC_URL (e.g., `/`, `&`) | |
ESCAPED_RPC_URL=$(echo "$RPC_URL" | sed 's/[&/]/\\&/g') | |
# Inject the RPC URL into the .env file | |
sed -i "s|l2_rpc_url=http://127.0.0.1:.*|l2_rpc_url=$ESCAPED_RPC_URL|" .env | |
# Update BATS_LIB_PATH dynamically in the .env file | |
sed -i "s|BATS_LIB_PATH=.*|BATS_LIB_PATH=\"$(pwd)/scripts/bats-scripts/lib\"|" .env | |
# Debug: Output the updated .env file | |
- name: Output .env for Debugging | |
run: cat .env | |
# Step 6: Install Bats for Testing | |
- name: Install Bats | |
run: | | |
if ! command -v bats &> /dev/null; then | |
sudo apt-get update | |
sudo apt-get install -y bats | |
else | |
echo "Bats is already installed." | |
fi | |
# Step 2: Install Foundry (for cast) | |
- name: Install Foundry (and cast) | |
run: | | |
curl -L https://foundry.paradigm.xyz | bash | |
. /home/runner/.bashrc | |
foundryup | |
# Step 3: Export Foundry Path | |
- name: Export Foundry Path | |
run: | | |
echo "export PATH=\$HOME/.foundry/bin:\$PATH" >> $GITHUB_ENV | |
# Step 7: Run Makefile commands for tests | |
- name: Run Tests | |
run: | | |
make test-bats | |
make test-go |