Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Test Programs

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
Comment on lines +3 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Tighten trigger syntax to satisfy yamllint

yamllint flags the current trigger block (on, [ main ]). Quote the key and drop the extra spaces to clear the errors:

-on:
-  push:
-    branches: [ main ]
-  pull_request:
-    branches: [ main ]
+'on':
+  push:
+    branches: [main]
+  pull_request:
+    branches: [main]
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 5-5: too many spaces inside brackets

(brackets)


[error] 5-5: too many spaces inside brackets

(brackets)


[error] 7-7: too many spaces inside brackets

(brackets)


[error] 7-7: too many spaces inside brackets

(brackets)

🤖 Prompt for AI Agents
In .github/workflows/test.yml around lines 3 to 8, tighten the GitHub Actions
trigger syntax to satisfy yamllint by removing the extra spaces in the branches
array and quoting keys/strings: replace occurrences like branches: [ main ] with
branches: ["main"] (no spaces inside the brackets) and ensure any YAML keys or
string values flagged by yamllint are quoted as required (e.g., "on" or branch
names) so the trigger block is valid.


jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.82'
override: true
Comment on lines +17 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Replace the deprecated Rust setup action.

actions-rs/toolchain@v1 is stuck on the retired Node12 runtime, so this step fails before installing Rust. Switch to a maintained action (e.g., dtolnay/rust-toolchain@master with toolchain: 1.82) so the workflow can provision Rust successfully.

🧰 Tools
🪛 actionlint (1.7.8)

18-18: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/test.yml around lines 17 to 21: the workflow uses the
deprecated actions-rs/toolchain@v1 which runs on a retired Node12 runtime and
fails; replace that step with a maintained action such as
dtolnay/rust-toolchain@master and set the input to toolchain: '1.82' (remove the
deprecated override flag), ensuring the step name and inputs match the new
action's expected keys so the workflow can provision Rust successfully.


Comment on lines +17 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Replace the deprecated Rust toolchain action

actions-rs/toolchain@v1 now targets the removed Node12 runtime, so the step fails before the workflow can install Rust. Switch to a maintained setup action. For example:

-    - name: Setup Rust
-      uses: actions-rs/toolchain@v1
-      with:
-        toolchain: '1.82'
-        override: true
+    - name: Setup Rust
+      uses: dtolnay/rust-toolchain@master
+      with:
+        toolchain: 1.82
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.82'
override: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.82
🧰 Tools
🪛 actionlint (1.7.7)

18-18: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In .github/workflows/test.yml around lines 17-22, the workflow uses the
deprecated actions-rs/toolchain@v1 (Node12 runtime) which fails; replace that
step with a maintained setup action such as dtolnay/setup-rust@v1 (or
actions-rs/toolchain@v2 if available) and set the rust-version input to '1.82'
(remove the Node12-specific override), e.g., swap the uses line to
dtolnay/setup-rust@v1 and provide rust-version: '1.82' so the workflow installs
Rust with a supported action.

- name: Install Solana CLI
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Install Anchor CLI
run: |
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install 0.31.1
avm use 0.31.1
echo "$HOME/.avm/bin" >> $GITHUB_PATH

- name: Install MagicBlock Ephemeral Validator
run: |
npm install -g @magicblock-labs/ephemeral-validator@latest

Comment on lines +35 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Pin Ephemeral Validator npm version for reproducibility

Installing @latest is brittle. Pin a known-good version to avoid sudden CI breaks.

-        npm install -g @magicblock-labs/ephemeral-validator@latest
+        npm install -g @magicblock-labs/ephemeral-validator@<pinned-version>

If you share the target version, I can update the diff.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Install MagicBlock Ephemeral Validator
run: |
npm install -g @magicblock-labs/ephemeral-validator@latest
- name: Install MagicBlock Ephemeral Validator
run: |
npm install -g @magicblock-labs/ephemeral-validator@<pinned-version>
🤖 Prompt for AI Agents
.github/workflows/test.yml around lines 35 to 38: the workflow installs
@magicblock-labs/ephemeral-validator using @latest which is brittle; change the
install step to pin a specific known-good semver (e.g., @1.2.3) or reference a
repository variable/GITHUB_REF for the approved release, updating the npm
install -g invocation to use that explicit version string (and if you want, add
a comment or workflow input to make future version updates explicit).

- name: Configure Solana
run: |
solana config set --url localhost
solana-keygen new --no-bip39-passphrase --silent --outfile ~/.config/solana/id.json

- name: Start Solana Test Validator
run: |
solana-test-validator \
--ledger ./my-ledger-1 \
--reset \
--clone mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev \
--clone EpJnX7ueXk7fKojBymqmVuCuwyhDQsYcLVL1XMsBbvDX \
--clone 7JrkjmZPprHwtuvtuGTXp9hwfGYFAQLnLeFM52kqAgXg \
--clone noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV \
--clone-upgradeable-program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh \
--clone Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh \
--clone 5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc \
--clone F72HqCR8nwYsVyeVd38pgKkjXmXFzVAM8rjZZsXWbdE \
--clone vrfkfM4uoisXZQPrFiS2brY4oMkU9EWjyvmvqaFd5AS \
--clone-upgradeable-program Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz \
--clone-upgradeable-program BTWAqWNBmF2TboMh3fxMJfgR16xGHYD7Kgr2dPwbRPBi \
--url https://api.devnet.solana.com &

# Wait for validator to be ready
timeout 30 bash -c 'until solana cluster-version --url http://localhost:8899 >/dev/null 2>&1; do sleep 1; done'

- name: Start MagicBlock Ephemeral Validator
run: |
RUST_LOG=info ephemeral-validator \
--accounts-lifecycle ephemeral \
--remote-cluster development \
--remote-url http://127.0.0.1:8899 \
--remote-ws-url ws://127.0.0.1:8900 \
--rpc-port 7799 &
Comment on lines +72 to +77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Drop the contradictory --remote-cluster development flag.

You’re pointing ephemeral-validator at the local Solana endpoints while simultaneously declaring the source cluster as development. Those settings conflict and can lead to the validator syncing from the wrong source. Remove --remote-cluster development (or swap the URLs to devnet) so the configuration is coherent.

🤖 Prompt for AI Agents
.github/workflows/test.yml around lines 72 to 77: the ephemeral-validator
invocation includes a contradictory flag --remote-cluster development while
pointing at local URLs; remove the --remote-cluster development flag (or
alternatively replace the local URLs with devnet endpoints) so the command
either targets local endpoints only or consistently targets the development
cluster, ensuring configuration coherence.


# Wait for validator to be ready
timeout 20 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done'

- name: Build and Deploy anchor-counter
run: |
cd anchor-counter
anchor build && anchor deploy --provider.cluster localnet

- name: Test anchor-counter
run: |
cd anchor-counter
EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
PROVIDER_ENDPOINT=http://localhost:8899 \
WS_ENDPOINT=http://localhost:8900 \
anchor test

# - name: Test anchor-minter
# run: |
# cd anchor-minter
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# anchor test

# - name: Test anchor-rock-paper-scissor
# run: |
# cd anchor-rock-paper-scissor
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# anchor test

# - name: Test bolt-counter
# run: |
# cd bolt-counter
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# yarn test

# - name: Test dummy-token-transfer
# run: |
# cd dummy-token-transfer
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# anchor test

# - name: Test roll-dice
# run: |
# cd roll-dice
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# anchor test

# - name: Test rust-counter
# run: |
# cd rust-counter
# yarn install
# EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \
# EPHEMERAL_WS_ENDPOINT=ws://localhost:7800 \
# PROVIDER_ENDPOINT=http://localhost:8899 \
# WS_ENDPOINT=http://localhost:8900 \
# yarn test
Loading