|
| 1 | +name:"Setup All Development Tools" |
| 2 | +description:"Sets up Solana, Anchor, and verification tools with optional installations" |
| 3 | + |
| 4 | +inputs: |
| 5 | +solana_version: |
| 6 | +description:"Solana version to install (leave empty to skip)" |
| 7 | +required:false |
| 8 | +default:"" |
| 9 | +anchor_version: |
| 10 | +description:"Anchor version to install (leave empty to skip)" |
| 11 | +required:false |
| 12 | +default:"" |
| 13 | +verify_version: |
| 14 | +description:"Solana verify version to install (leave empty to skip)" |
| 15 | +required:false |
| 16 | +default:"" |
| 17 | +node_version: |
| 18 | +description:"Node version to install (leave empty to skip)" |
| 19 | +required:false |
| 20 | +default:"" |
| 21 | + |
| 22 | +runs: |
| 23 | +using:"composite" |
| 24 | +steps: |
| 25 | + -run:sudo apt-get update |
| 26 | +shell:bash |
| 27 | + -run:sudo apt-get install -y pkg-config build-essential libudev-dev |
| 28 | +shell:bash |
| 29 | + -run:git submodule update --init --recursive --depth 1 |
| 30 | +shell:bash |
| 31 | + |
| 32 | + -uses:actions/cache@v4 |
| 33 | +if:inputs.solana_version != '' |
| 34 | +name:Cache Solana Tool Suite |
| 35 | +id:cache-solana |
| 36 | +with: |
| 37 | +path:| |
| 38 | + ~/.cache/solana/ |
| 39 | + ~/.local/share/solana/ |
| 40 | +key:solana-${{ runner.os }}-v0001-${{ env.SOLANA_VERSION }} |
| 41 | + |
| 42 | + -name:Debug Solana Version Values |
| 43 | +if:inputs.solana_version != '' |
| 44 | +shell:bash |
| 45 | +run:| |
| 46 | + echo "=== Debug Solana Version Information ===" |
| 47 | + VERSION="${{ inputs.solana_version }}" |
| 48 | + echo "Using Solana version: $VERSION" |
| 49 | + echo "Cache key being used: solana-${{ runner.os }}-v0001-${{ env.SOLANA_VERSION }}" |
| 50 | + echo "=========================" |
| 51 | +
|
| 52 | + -name:Install Solana |
| 53 | +shell:bash |
| 54 | +if:steps.cache-solana.outputs.cache-hit != 'true' && inputs.solana_version != '' |
| 55 | +run:| |
| 56 | + # Parse version numbers |
| 57 | + MAJOR=$(echo $SOLANA_VERSION | cut -d. -f1) |
| 58 | + MINOR=$(echo $SOLANA_VERSION | cut -d. -f2) |
| 59 | + PATCH=$(echo $SOLANA_VERSION | cut -d. -f3) |
| 60 | +
|
| 61 | + # Determine which URL to use based on version |
| 62 | + if [ "$MAJOR" -eq 1 ] && [ "$MINOR" -eq 18 ] && [ "$PATCH" -le 23 ]; then |
| 63 | + INSTALL_URL="https://release.solana.com/v${SOLANA_VERSION}/install" |
| 64 | + else |
| 65 | + INSTALL_URL="https://release.anza.xyz/v${SOLANA_VERSION}/install" |
| 66 | + fi |
| 67 | +
|
| 68 | + echo "Installing Solana from: $INSTALL_URL" |
| 69 | + sh -c "$(curl -sSfL $INSTALL_URL)" |
| 70 | +env: |
| 71 | +SOLANA_VERSION:${{ env.SOLANA_VERSION }} |
| 72 | + |
| 73 | + -name:Set Solana Path variables |
| 74 | +if:inputs.solana_version != '' |
| 75 | +run:echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH |
| 76 | +shell:bash |
| 77 | + |
| 78 | + -name:Create default keypair |
| 79 | +if:inputs.solana_version != '' |
| 80 | +run:solana-keygen new -s --no-bip39-passphrase --force |
| 81 | +shell:bash |
| 82 | + |
| 83 | + -name:Set rpc connection to local host |
| 84 | +if:inputs.solana_version != '' |
| 85 | +run:solana config set --url localhost |
| 86 | +shell:bash |
| 87 | + |
| 88 | + -name:Debug Version Values |
| 89 | +if:inputs.anchor_version != '' |
| 90 | +shell:bash |
| 91 | +run:| |
| 92 | + echo "=== Debug Version Information ===" |
| 93 | + VERSION="${{ inputs.anchor-version || env.ANCHOR_VERSION }}" |
| 94 | + echo "Using Anchor version: $VERSION" |
| 95 | + echo "Cache key being used: anchor-cli-${{ runner.os }}-v0003-$VERSION" |
| 96 | + echo "=========================" |
| 97 | +
|
| 98 | + -uses:actions/cache@v4 |
| 99 | +if:inputs.anchor_version != '' |
| 100 | +name:Cache Anchor Cli |
| 101 | +id:cache-anchor-cli |
| 102 | +with: |
| 103 | +path:| |
| 104 | + ~/.cargo/bin/anchor |
| 105 | +key:anchor-cli-${{ runner.os }}-v0003-${{ inputs.anchor-version || env.ANCHOR_VERSION }} |
| 106 | + |
| 107 | + -name:Install Anchor CLI |
| 108 | +shell:bash |
| 109 | +if:steps.cache-anchor-cli.outputs.cache-hit != 'true' && inputs.anchor_version != '' |
| 110 | +run:| |
| 111 | + VERSION="${{ inputs.anchor-version || env.ANCHOR_VERSION }}" |
| 112 | + echo "=== Installation Debug Info ===" |
| 113 | + echo "Installing Anchor version: $VERSION" |
| 114 | + echo "=== Starting Installation ===" |
| 115 | + cargo install --git https://github.com/coral-xyz/anchor --tag "v$VERSION" anchor-cli --force |
| 116 | + echo "=== Installation Complete ===" |
| 117 | + anchor --version |
| 118 | +
|
| 119 | + -name:Verify Anchor Installation |
| 120 | +if:inputs.anchor_version != '' |
| 121 | +shell:bash |
| 122 | +run:anchor --version |
| 123 | + |
| 124 | + -name:Debug Version Values |
| 125 | +if:inputs.verify-version != '' |
| 126 | +shell:bash |
| 127 | +run:| |
| 128 | + echo "=== Debug Version Information ===" |
| 129 | + echo "Using solana-verify version: ${{ inputs.verify-version }}" |
| 130 | + echo "Cache key being used: solana-verify-${{ runner.os }}-v0001-${{ inputs.verify-version }}" |
| 131 | + echo "=========================" |
| 132 | +
|
| 133 | + -uses:actions/cache@v4 |
| 134 | +if:inputs.verify-version != '' |
| 135 | +name:Cache Solana Verify |
| 136 | +id:cache-solana-verify |
| 137 | +with: |
| 138 | +path:| |
| 139 | + ~/.cargo/bin/solana-verify |
| 140 | +key:solana-verify-${{ runner.os }}-v0001-${{ inputs.verify-version }} |
| 141 | + |
| 142 | + -name:Install Solana Verify |
| 143 | +if:steps.cache-solana-verify.outputs.cache-hit != 'true' && inputs.verify-version != '' |
| 144 | +shell:bash |
| 145 | +run:cargo install solana-verify --version ${{ inputs.verify-version }} |
| 146 | + |
| 147 | + -name:Verify Installation |
| 148 | +if:inputs.verify-version != '' |
| 149 | +shell:bash |
| 150 | +run:solana-verify --version |
| 151 | + |
| 152 | + -uses:actions/setup-node@v3 |
| 153 | +if:inputs.node_version != '' |
| 154 | +with: |
| 155 | +node-version:${{ inputs.node_version }} |