Skip to content

Commit

Permalink
first attempt matrix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelArtists committed Jan 22, 2025
1 parent 715211b commit a47d29a
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/ci-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI Workflow

on:
push:
branches:
- '**'

jobs:
matrix-build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
config:
- network: fork9-legacy-zkevm-stack-rollup.yml
test_types: [bats]
- network: fork11-new-cdk-stack-rollup.yml
test_types: [bats, go]
- network: fork12-new-cdk-stack-rollup.yml
test_types: [go]

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: ${{ matrix.config.network }}"
kurtosis run --enclave cdk github.com/0xPolygon/[email protected] \
--args-file=https://raw.githubusercontent.com/0xPolygon/kurtosis-cdk/main/.github/tests/combinations/${{ matrix.config.network }}
# 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
if: contains(fromJson(matrix.config.test_types), '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
if: contains(fromJson(matrix.config.test_types), 'bats')
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

# Step 8: Run Tests Based on Matrix Configuration
- name: Run Bats Tests
if: contains(fromJson(matrix.config.test_types), 'bats')
run: |
echo "Running Bats tests using Makefile"
make test-bats
- name: Run Go Tests
if: contains(fromJson(matrix.config.test_types), 'go')
run: |
echo "Running Go tests using Makefile"
make test-go

0 comments on commit a47d29a

Please sign in to comment.