install cast and set bats_lib_path correctly #25
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 Repository | |
uses: actions/checkout@v3 | |
# Step 2: Install Kurtosis CLI | |
- name: Install Kurtosis CLI | |
run: | | |
echo "Adding Kurtosis CLI to APT sources" | |
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 | |
echo "Kurtosis CLI version:" | |
kurtosis version | |
# Step 3: Spin up the Kurtosis Devnet | |
- name: Deploy Kurtosis Devnet | |
run: | | |
echo "Starting Kurtosis Devnet with CDK configuration" | |
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 4: Extract RPC URL from Kurtosis Service | |
- name: Extract RPC URL from Kurtosis | |
id: grab-url | |
run: | | |
echo "Querying Kurtosis for service details" | |
SERVICE_INFO=$(kurtosis service inspect cdk cdk-erigon-rpc-001) | |
echo "Extracting RPC URL (ignoring ws-rpc lines)" | |
RPC_URL=$(echo "$SERVICE_INFO" | grep -E '^ *rpc:' | awk -F'-> ' '{print $2}' | awk '{print $1}') | |
echo "Extracted RPC_URL: $RPC_URL" | |
echo "Escaping special characters in RPC_URL" | |
ESCAPED_RPC_URL=$(echo "$RPC_URL" | sed 's/[&/]/\\&/g') | |
echo "Injecting RPC_URL into .env file" | |
sed -i "s|l2_rpc_url=http://127.0.0.1:.*|l2_rpc_url=$ESCAPED_RPC_URL|" .env | |
echo "Dynamically updating BATS_LIB_PATH in .env" | |
sed -i "s|BATS_LIB_PATH=.*|BATS_LIB_PATH=\"$(pwd)/scripts/bats-scripts/lib\"|" .env | |
# Step 5: Debugging - Output the updated .env file | |
- name: Debug .env File | |
run: | | |
echo "Updated .env file contents:" | |
cat .env | |
# Step 6: Install Bats Testing Framework | |
- name: Install Bats | |
run: | | |
echo "Installing Bats if not already installed" | |
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 7: Install Foundry Toolchain | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: stable | |
# Step 8: Run Tests via Makefile | |
- name: Run Bats Tests | |
run: | | |
echo "Running Bats tests using Makefile" | |
make test-bats |