|
| 1 | +name: Test Examples |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + test-examples: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Rust |
| 18 | + uses: actions-rs/toolchain@v1 |
| 19 | + with: |
| 20 | + toolchain: "1.85.0" |
| 21 | + override: true |
| 22 | + |
| 23 | + - name: Install Solana |
| 24 | + run: | |
| 25 | + sh -c "$(curl -sSfL https://release.anza.xyz/v2.3.13/install)" |
| 26 | + echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH |
| 27 | +
|
| 28 | + - name: Install Anchor |
| 29 | + run: | |
| 30 | + cargo install --git https://github.com/coral-xyz/anchor avm --locked --force |
| 31 | + avm install 0.32.1 |
| 32 | + avm use 0.32.1 |
| 33 | + echo "$HOME/.avm/bin" >> $GITHUB_PATH |
| 34 | +
|
| 35 | + - name: Install MagicBlock Ephemeral Validator |
| 36 | + run: | |
| 37 | + npm install -g @magicblock-labs/ephemeral-validator@latest |
| 38 | +
|
| 39 | + - name: Configure Solana |
| 40 | + run: | |
| 41 | + solana config set --url localhost |
| 42 | + solana-keygen new --no-bip39-passphrase --silent --outfile ~/.config/solana/id.json |
| 43 | +
|
| 44 | + - name: Start Solana Test Validator |
| 45 | + run: | |
| 46 | + solana-test-validator \ |
| 47 | + --ledger ./my-ledger-1 \ |
| 48 | + --reset \ |
| 49 | + --clone mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev \ |
| 50 | + --clone EpJnX7ueXk7fKojBymqmVuCuwyhDQsYcLVL1XMsBbvDX \ |
| 51 | + --clone 7JrkjmZPprHwtuvtuGTXp9hwfGYFAQLnLeFM52kqAgXg \ |
| 52 | + --clone noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV \ |
| 53 | + --clone-upgradeable-program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh \ |
| 54 | + --clone Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh \ |
| 55 | + --clone 5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc \ |
| 56 | + --clone F72HqCR8nwYsVyeVd38pgKkjXmXFzVAM8rjZZsXWbdE \ |
| 57 | + --clone vrfkfM4uoisXZQPrFiS2brY4oMkU9EWjyvmvqaFd5AS \ |
| 58 | + --clone-upgradeable-program Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz \ |
| 59 | + --clone-upgradeable-program BTWAqWNBmF2TboMh3fxMJfgR16xGHYD7Kgr2dPwbRPBi \ |
| 60 | + --url https://api.devnet.solana.com & |
| 61 | +
|
| 62 | + # Wait for validator to be ready |
| 63 | + timeout 30 bash -c 'until solana cluster-version --url http://localhost:8899 >/dev/null 2>&1; do sleep 1; done' |
| 64 | +
|
| 65 | + - name: Start MagicBlock Ephemeral Validator |
| 66 | + run: | |
| 67 | + # Magic voodoo to increase resource limits |
| 68 | + sudo prlimit --pid $$ --nofile=1048576:1048576 |
| 69 | + sudo sysctl fs.inotify.max_user_instances=1280 |
| 70 | + sudo sysctl fs.inotify.max_user_watches=655360 |
| 71 | + RUST_LOG=info ephemeral-validator \ |
| 72 | + --accounts-lifecycle ephemeral \ |
| 73 | + --remote-cluster development \ |
| 74 | + --remote-url http://127.0.0.1:8899 \ |
| 75 | + --remote-ws-url ws://127.0.0.1:8900 \ |
| 76 | + --rpc-port 7799 & |
| 77 | +
|
| 78 | + # Wait for validator to be ready |
| 79 | + timeout 20 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done' |
| 80 | + - name: Test anchor-counter |
| 81 | + run: | |
| 82 | + cd anchor-counter |
| 83 | + anchor build && anchor deploy --provider.cluster localnet |
| 84 | + yarn install |
| 85 | + EPHEMERAL_PROVIDER_ENDPOINT="http://localhost:7799" \ |
| 86 | + EPHEMERAL_WS_ENDPOINT="ws://localhost:7800" \ |
| 87 | + PROVIDER_ENDPOINT=http://localhost:8899 \ |
| 88 | + WS_ENDPOINT=http://localhost:8900 \ |
| 89 | + anchor test \ |
| 90 | + --provider.cluster localnet \ |
| 91 | + --skip-local-validator \ |
| 92 | + --skip-deploy |
| 93 | +
|
| 94 | + - name: Test anchor-minter |
| 95 | + run: | |
| 96 | + cd anchor-minter |
| 97 | + anchor build && anchor deploy --provider.cluster localnet |
| 98 | + yarn install |
| 99 | + anchor test \ |
| 100 | + --skip-deploy |
| 101 | +
|
| 102 | + - name: Test anchor-rock-paper-scissor |
| 103 | + run: | |
| 104 | + cd anchor-rock-paper-scissor |
| 105 | + anchor build |
| 106 | + yarn install |
| 107 | + anchor test \ |
| 108 | + --skip-deploy |
| 109 | +
|
| 110 | + # - name: Test bolt-counter |
| 111 | + # run: | |
| 112 | + # cd bolt-counter |
| 113 | + # yarn install |
| 114 | + # EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \ |
| 115 | + # EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \ |
| 116 | + # PROVIDER_ENDPOINT=http://localhost:8899 \ |
| 117 | + # WS_ENDPOINT=http://localhost:8900 \ |
| 118 | + # yarn test |
| 119 | + |
| 120 | + - name: Test dummy-token-transfer |
| 121 | + run: | |
| 122 | + cd dummy-token-transfer |
| 123 | + yarn install |
| 124 | + EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \ |
| 125 | + EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \ |
| 126 | + PROVIDER_ENDPOINT=http://localhost:8899 \ |
| 127 | + WS_ENDPOINT=http://localhost:8900 \ |
| 128 | + anchor test |
| 129 | +
|
| 130 | + - name: Test magic-actions |
| 131 | + run: | |
| 132 | + cd magic-actions |
| 133 | + yarn install |
| 134 | + anchor build |
| 135 | + yarn install |
| 136 | + anchor test \ |
| 137 | + --skip-deploy |
| 138 | +
|
| 139 | + - name: Test oncurve-delegation |
| 140 | + run: | |
| 141 | + cd oncurve-delegation |
| 142 | + yarn install |
| 143 | + yarn test |
| 144 | + yarn test-web3js |
| 145 | +
|
| 146 | + - name: Test roll-dice |
| 147 | + run: | |
| 148 | + cd roll-dice |
| 149 | + yarn install |
| 150 | + EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \ |
| 151 | + EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \ |
| 152 | + PROVIDER_ENDPOINT=http://localhost:8899 \ |
| 153 | + WS_ENDPOINT=http://localhost:8900 \ |
| 154 | + anchor test |
| 155 | +
|
| 156 | + - name: Test rust-counter |
| 157 | + run: | |
| 158 | + cd rust-counter |
| 159 | + yarn install |
| 160 | + EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \ |
| 161 | + EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \ |
| 162 | + PROVIDER_ENDPOINT=http://localhost:8899 \ |
| 163 | + WS_ENDPOINT=http://localhost:8900 \ |
| 164 | + yarn test |
| 165 | +
|
| 166 | + - name: Test session-keys |
| 167 | + run: | |
| 168 | + cd session-keys |
| 169 | + yarn install |
| 170 | + anchor build |
| 171 | + yarn install |
| 172 | + anchor test \ |
| 173 | + --skip-deploy |
0 commit comments