fix ci conditionals #3
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: EVM Regression Tests | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
e2e: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: | |
- network: fork9-legacy-zkevm-stack-rollup.yml | |
rpc_service: zkevm-node-rpc-001 | |
test_types: [bats] | |
- network: fork11-new-cdk-stack-rollup.yml | |
rpc_service: cdk-erigon-rpc-001 | |
test_types: [bats, go] | |
- network: fork12-new-cdk-stack-rollup.yml | |
rpc_service: cdk-erigon-rpc-001 | |
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 "Extracting RPC URL using kurtosis port print" | |
RPC_URL=$(kurtosis port print cdk ${{ matrix.config.rpc_service }} rpc) | |
echo "Extracted RPC_URL: $RPC_URL" | |
echo "Injecting RPC_URL into .env file" | |
sed -i "s|l2_rpc_url=http://127.0.0.1:.*|l2_rpc_url=$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(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(matrix.config.test_types, 'go') | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: stable | |
# Step 8: Run Tests Based on Matrix Configuration | |
- name: Run Bats Tests | |
if: contains(matrix.config.test_types, 'bats') | |
run: | | |
echo "Running Bats tests using Makefile" | |
make test-bats | |
- name: Run Go Tests | |
if: contains(matrix.config.test_types, 'go') | |
run: | | |
echo "Running Go tests using Makefile" | |
make test-go |