Skip to content

Comments

E2E workflow example#2446

Draft
shamil-gadelshin wants to merge 7 commits intodevnet-readyfrom
e2e-lib
Draft

E2E workflow example#2446
shamil-gadelshin wants to merge 7 commits intodevnet-readyfrom
e2e-lib

Conversation

@shamil-gadelshin
Copy link
Collaborator

Description

This PR contains an example of E2E workflow for subtensor.

Content

  • e2e.yml - github workflow
  • start_nodes package - simple TS project to start subtensor nodes and wait for several blocks
  • shared package - a TS package to accumulate subtensor logic (registerSubnet, setBalance, etc)
  • staking-tests - a sample package with a single mocha test (add_stake).

Comment

The PR uses TS code from our check-node-compat workflow to manage nodes, polkadot api to generate typed metadata from the current runtime version similar to our current contract-tests package.

@shamil-gadelshin shamil-gadelshin self-assigned this Feb 19, 2026
@shamil-gadelshin shamil-gadelshin marked this pull request as draft February 19, 2026 12:33
Comment on lines +16 to +78
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
protobuf-compiler \
libprotobuf-dev \
libclang-dev \
clang \
cmake \
build-essential

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Build node with release, fast-runtime, and metadata-hash
run: |
cargo build \
--profile release \
--features "fast-runtime metadata-hash pow-faucet" \
-p node-subtensor

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"

- name: Install start-nodes dependencies
working-directory: e2e/start-nodes
run: npm install

- name: Start validator nodes
working-directory: e2e/start-nodes
run: npx tsx main.ts

- name: Install polkadot-api for papi CLI
working-directory: e2e
run: npm install

- name: Generate PAPI descriptors from running node
working-directory: e2e
run: |
rm -rf .papi
npx papi add devnet -w ws://localhost:9944

- name: Install shared dependencies
working-directory: e2e/shared
run: npm install

- name: Install staking-tests dependencies
working-directory: e2e/staking-tests
run: npm install

- name: Run staking tests
working-directory: e2e/staking-tests
run: npm test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 3 days ago

The fix is to explicitly restrict the GITHUB_TOKEN permissions for this workflow to the minimum needed. The job only needs to read the repository contents (for actions/checkout@v4); it does not create releases, push commits, open issues, or modify PRs. Therefore, we can safely set contents: read either at the workflow root (applying to all jobs) or on the e2e-tests job itself. To keep the change minimal and clear, add a top-level permissions: block just after the on: block.

Concretely, in .github/workflows/e2e.yml, insert:

permissions:
  contents: read

between the on: section and the concurrency: section (after line 5, before line 6 in the provided snippet). No additional imports or methods are needed, as this is purely a YAML configuration change.

Suggested changeset 1
.github/workflows/e2e.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -3,6 +3,9 @@
 on:
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 concurrency:
   group: e2e-${{ github.ref }}
   cancel-in-progress: true
EOF
@@ -3,6 +3,9 @@
on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant