Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): enable typegen_check #3145

Merged
merged 9 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
65 changes: 65 additions & 0 deletions .github/workflows/update-typescript-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Update Rust/TS bindings

on:
workflow_dispatch:
schedule:
- cron: "0 5 * * *" # Runs every day at 5:00 AM UTC

jobs:
build:
runs-on:
labels: bare-metal
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Local build new Node
uses: ./.github/workflow-templates/cargo-build
- name: Upload Node
uses: actions/upload-artifact@v4
with:
name: moonbeam
path: build

update-typescript-api:
needs: build
runs-on: moonbeam-release-medium
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Node
uses: actions/download-artifact@v4
with:
name: moonbeam
path: target/release
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: "test/.nvmrc"
cache: pnpm
registry-url: https://registry.npmjs.org/
- name: Run Typegen
run: |
chmod uog+x target/release/moonbeam
pnpm i
cd test
pnpm typegen
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
base: master
branch: "update-typescript-api-${{ github.run_id }}"
commit-message: "Update Rust/TS bindings"
draft: true
title: "Update Rust/TS bindings"
reviewers: "moonsong-coredev"
labels: "B0-silent,D2-notlive"
8 changes: 4 additions & 4 deletions typescript-api/scripts/scrapeMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const CHAINS = ["moonbase", "moonriver", "moonbeam"];
const fetchMetadata = async (port = 9933) => {
const maxRetries = 60;
const sleepTime = 500;
const url = `http://localhost:${port}`;
const url = `http://127.0.0.1:${port}`;
const payload = {
id: "1",
jsonrpc: "2.0",
Expand Down Expand Up @@ -75,7 +75,7 @@ async function main() {
const metadata = await fetchMetadata();
fs.writeFileSync(`metadata-${chain}.json`, JSON.stringify(metadata, null, 2));
console.log(`✅ Metadata for ${chain} written to metadata-${chain}.json`);
nodes[chain].kill();
nodes[chain]?.kill();
await new Promise((resolve) => setTimeout(resolve, 2000));
} catch (error) {
console.error(`❌ Error getting metadata for ${chain}`);
Expand All @@ -86,7 +86,7 @@ async function main() {

process.on("SIGINT", () => {
for (const chain of CHAINS) {
nodes[chain].kill();
nodes[chain]?.kill();
}
process.exit();
});
Expand All @@ -98,6 +98,6 @@ main()
})
.finally(() => {
for (const chain of CHAINS) {
nodes[chain].kill();
nodes[chain]?.kill();
}
});
Loading