Skip to content

Commit

Permalink
Merge pull request #134 from arda-org/add-ci-fullsimulnet
Browse files Browse the repository at this point in the history
Add CI for fullsimulnet + fixes for lightsimulnet
  • Loading branch information
lcswillems authored May 30, 2024
2 parents a882f98 + 90b9bc3 commit 0e41c8f
Show file tree
Hide file tree
Showing 69 changed files with 10,176 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.19
cache-dependency-path: xsuite-lightsimulnet/src/go.sum
cache-dependency-path: |
xsuite-fullsimulnet/build-binary.mjs
xsuite-lightsimulnet/src/go.sum
- name: Build xsuite-fullsimulnet
run: pnpm build-xsuite-fullsimulnet

- name: Build xsuite-lightsimulnet
run: pnpm build-xsuite-lightsimulnet
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/release-xsuite-fullsimulnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release xsuite-fullsimulnet

on:
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [macos-12, ubuntu-20.04]

runs-on: ${{ matrix.os }}

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

- name: Use Node.js & pnpm
uses: ./.github/actions/node-pnpm

- name: Use Golang
uses: actions/setup-go@v5
with:
go-version: 1.19
cache-dependency-path: xsuite-fullsimulnet/build-binary.mjs

- name: Build xsuite-fullsimulnet
run: pnpm build-xsuite-fullsimulnet

- name: Upload package
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: |
xsuite-fullsimulnet-darwin-amd64/bin/fsproxy
xsuite-fullsimulnet-linux-amd64/bin/fsproxy
test:
needs: build

strategy:
matrix:
os: [macos-12, ubuntu-20.04]

runs-on: ${{ matrix.os }}

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

- name: Download package
uses: actions/download-artifact@v4
with:
pattern: package-*
merge-multiple: true

- name: Use Node.js & pnpm
uses: ./.github/actions/node-pnpm

- name: Test xsuite-fullsimulnet
run: pnpm test-xsuite-fullsimulnet

publish:
needs: test

runs-on: ubuntu-20.04

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

- name: Download package
uses: actions/download-artifact@v4
with:
pattern: package-*
merge-multiple: true

- name: Use Node.js & pnpm
uses: ./.github/actions/node-pnpm
with:
node-registry-url: "https://registry.npmjs.org"

- name: Publish xsuite-fullsimulnet packages to NPM
run: git config core.fileMode false && pnpm --filter "@xsuite/full-simulnet*" publish --publish-branch dev --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release-xsuite-lightsimulnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Use Node.js & pnpm
uses: ./.github/actions/node-pnpm

- name: Test
- name: Test xsuite-lightsimulnet
run: pnpm test-xsuite-lightsimulnet

publish:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"private": true,
"scripts": {
"lint": "eslint .",
"build-xsuite-fullsimulnet": "cd xsuite-fullsimulnet && pnpm build",
"test-xsuite-fullsimulnet": "cd xsuite-fullsimulnet && pnpm test",
"build-xsuite-lightsimulnet": "cd xsuite-lightsimulnet && pnpm build",
"test-xsuite-lightsimulnet": "cd xsuite-lightsimulnet && pnpm test",
"build-xsuite": "cd xsuite && pnpm build",
Expand All @@ -10,10 +12,10 @@
"build-contracts": "pnpm --filter \"./contracts/**\" build --locked --target-dir $(pwd)/target",
"typecheck-contracts": "pnpm --filter \"./contracts/**\" typecheck",
"test-contracts": "pnpm --filter \"./contracts/**\" test",
"ci-main": "pnpm lint && pnpm build-xsuite-lightsimulnet && pnpm build-xsuite && pnpm test-xsuite && pnpm verify-xsuite-wasms && pnpm build-contracts && pnpm typecheck-contracts && pnpm test-contracts",
"ci-main": "pnpm lint && pnpm build-xsuite-fullsimulnet && pnpm build-xsuite-lightsimulnet && pnpm build-xsuite && pnpm test-xsuite && pnpm verify-xsuite-wasms && pnpm build-contracts && pnpm typecheck-contracts && pnpm test-contracts",
"dev-docs": "cd docs && pnpm dev",
"build-docs": "cd docs && pnpm build",
"release-versions": "./release-versions.mjs",
"release-versions": "node release-versions.mjs",
"update-contracts-deps": "pnpm up -r commander tsx typescript vitest --latest"
},
"devDependencies": {
Expand Down
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
packages:
- "docs"
- "xsuite"
- "xsuite-fullsimulnet"
- "xsuite-fullsimulnet-darwin-amd64"
- "xsuite-fullsimulnet-linux-amd64"
- "xsuite-lightsimulnet"
- "xsuite-lightsimulnet-darwin-amd64"
- "xsuite-lightsimulnet-linux-amd64"
Expand Down
2 changes: 0 additions & 2 deletions release-versions.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import fs from "node:fs";
import path from "node:path";
import { $, question } from "zx";
Expand Down
1 change: 1 addition & 0 deletions xsuite-fullsimulnet-darwin-amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/fsproxy
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions xsuite-fullsimulnet-darwin-amd64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@xsuite/full-simulnet-darwin-amd64",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"postinstall": "chmod -f +x ./bin/fsproxy || true"
},
"files": [
"bin"
]
}
1 change: 1 addition & 0 deletions xsuite-fullsimulnet-linux-amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/fsproxy
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions xsuite-fullsimulnet-linux-amd64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@xsuite/full-simulnet-linux-amd64",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"postinstall": "chmod -f +x ./bin/fsproxy || true"
},
"files": [
"bin"
]
}
1 change: 1 addition & 0 deletions xsuite-fullsimulnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
6 changes: 6 additions & 0 deletions xsuite-fullsimulnet/build-binary.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { $, minimist } from "zx";

const argv = minimist(process.argv.slice(2));

await $`GOBIN="$(pwd)" GOOS=${argv.os} GOARCH=${argv.arch} go install -ldflags ${argv.ldflags} github.com/multiversx/mx-chain-simulator-go/cmd/chainsimulator@v1.7.7`;
await $`mv ./chainsimulator ../xsuite-fullsimulnet-${argv.os}-${argv.arch}/bin/fsproxy`;
30 changes: 30 additions & 0 deletions xsuite-fullsimulnet/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[config]
[config.simulator]
# server-port paramter specifies the port of the http server
server-port = 8085
# num-of-shards parameter specifies the number of shard that chain simulator will simulate
num-of-shards = 3
# round-duration-in-milliseconds parameter specifies the duration of a simulated round. The timestamp between two headers will correspond to the round duration but will not reflect real-time
round-duration-in-milliseconds = 6000
# rounds-per-epoch specifies the number of rounds per epoch
rounds-per-epoch = 20
# initial-round specifies with what round the chain simulator will start
initial-round = 0
# initial-nonce specifies with what nonce the chain simulator will start
initial-nonce = 0
# initial-epoch specifies with what epoch the chain simulator will start
initial-epoch = 0
# mx-chain-go-repo will be used to fetch the node configs folder
mx-chain-go-repo = "https://github.com/multiversx/mx-chain-go"
# mx-chain-proxy-go-repo will be used to fetch the proxy configs folder
mx-chain-proxy-go-repo = "https://github.com/multiversx/mx-chain-proxy-go"
[config.logs]
log-file-life-span-in-mb = 256 # 256MB
log-file-life-span-in-sec = 432000 # 5 days
log-file-prefix = "chain-simulator"
logs-path = "logs"
[config.blocks-generator]
# auto-generate-blocks specifies if the chain simulator should auto generate blocks
auto-generate-blocks = false
# block-time-in-milliseconds specifies the time between blocks generation in case auto-generate-blocks is enabled
block-time-in-milliseconds = 6000
Loading

0 comments on commit 0e41c8f

Please sign in to comment.