From 0fe835e191c5c999326446d10ff6338b682e74a2 Mon Sep 17 00:00:00 2001 From: Jade Park Date: Fri, 30 Aug 2024 17:34:30 +0100 Subject: [PATCH] test: solana packages test on ci - check connection --- .github/workflows/solana-packages-test.yml | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/solana-packages-test.yml b/.github/workflows/solana-packages-test.yml index a9dc94e68..ab5842997 100644 --- a/.github/workflows/solana-packages-test.yml +++ b/.github/workflows/solana-packages-test.yml @@ -17,15 +17,22 @@ jobs: extra_nix_config: "sandbox = false" - name: Build and test solana-test-validator + run: nix run .#solana-test-validator + + - name: Check if validator is running run: | - nix run .#solana-test-validator & - sleep 10 - if curl --fail http://127.0.0.1:8899; then - echo "Validator is running and accessible" - else - echo "Failed to connect to the validator" - exit 1 - fi + for i in {1..10}; do + if curl --fail http://127.0.0.1:8899; then + echo "Localnet is running and accessible" + break + else + echo "Waiting for the localnet to start..." + sleep 3 + fi + if [ $i -eq 30 ]; then + echo "Localnet did not start within the expected time." + exit 1 + fi - name: Build solana-cli-env run: nix build .#solana-cli-env --print-out-paths