Browse Source

test run anchor build github action

John 1 year ago
parent
commit
f68cc6e4bb
1 changed files with 22 additions and 15 deletions
  1. 22 15
      .github/workflows/anchor.yml

+ 22 - 15
.github/workflows/anchor.yml

@@ -79,23 +79,30 @@ jobs:
           "tokens/token-2022/transfer-hook/anchor/TransferHookTransferCost"
           "tokens/token-2022/transfer-hook/anchor/TransferHookWhitelist"
           )
+          declare -a pids=()
+          declare -a failed_builds=()
+
           for projectDir in "${ProjectDirs[@]}"; do
-            echo "
-            ********
-            Building $projectDir
-            ********"
-            cd $projectDir
-            if anchor build; then
-              echo "Build succeeded for $projectDir."
-            else
-              failed=true
-              failed_builds+=($projectDir)
-              echo "Build failed for $projectDir. Continuing with the next program."
-            fi
-          cd - > /dev/null
+            (
+              echo "******** Building $projectDir ********"
+              cd $projectDir
+              if anchor build; then
+                echo "Build succeeded for $projectDir."
+              else
+                echo "Build failed for $projectDir."
+                # Capture the directory of failed build
+                failed_builds+=("$projectDir")
+              fi
+            ) &
+            pids+=($!)
           done
-          if [ "$failed" = true ]; then
-            echo "Programs that failed building:"
+
+          for pid in "${pids[@]}"; do
+            wait $pid
+          done
+
+          if [ ${#failed_builds[@]} -ne 0 ]; then
+            echo "Some builds failed:"
             printf "%s\n" "${failed_builds[@]}"
             exit 1
           else