Skip to content

Commit

Permalink
Implement blockchain service, update nestjs deps and update to node l…
Browse files Browse the repository at this point in the history
…ts (#23)

* Implement blockchain service, update nestjs deps and update to node lts

* Update changelogs

* Fix test and rename from test to spec

* Tidy up
  • Loading branch information
stwiname authored Feb 27, 2025
1 parent 92c6fc3 commit b675499
Show file tree
Hide file tree
Showing 45 changed files with 912 additions and 1,956 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ on:
workflow_dispatch:
inputs:
cpus:
description: 'docker cpus '
description: "docker cpus "
default: 2
require: true
memory:
description: 'docker memory'
default: '4g'
description: "docker memory"
default: "4g"
require: true
benchmark-time:
description: 'Benchmark time(h/m/s)'
description: "Benchmark time(h/m/s)"
default: 30m
require: true
indexerVersion:
description: 'indexer version'
default: 'latest'
description: "indexer version"
default: "latest"
require: true
deployment:
description: 'Deployment'
default: 'QmU4K4LKVLV7AxuQzXjwrUV77ZauwAky5P84PDaCrnn8sP' #ENS project
description: "Deployment"
default: "QmU4K4LKVLV7AxuQzXjwrUV77ZauwAky5P84PDaCrnn8sP" #ENS project
require: false
network-endpoint:
description: 'Network endpoint'
default: 'https://eth.api.onfinality.io/public'
description: "Network endpoint"
default: "https://eth.api.onfinality.io/public"
require: true
use-network-api-key:
description: 'Use api endpoint key'
description: "Use api endpoint key"
default: false
required: true
batch-size:
description: 'batch-size'
description: "batch-size"
default: 30
require: false
workers:
description: 'workers'
description: "workers"
default: 4
require: false
others:
description: 'Other flags'
description: "Other flags"
require: false

jobs:
Expand All @@ -48,7 +48,7 @@ jobs:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that `container-job` executes in
container: node:18
container: node:lts
services:
# Label used to access the service container
postgres:
Expand All @@ -70,7 +70,6 @@ jobs:
fetch-depth: 100
token: ${{ secrets.REPO_TOKEN }}


- name: Prepare Network Endpoint
id: prepare-network-endpoint
run: |
Expand All @@ -82,12 +81,12 @@ jobs:
echo "::set-output name=network-endpoint::${NETWORK_ENDPOINT}"
echo "::add-mask::${NETWORK_ENDPOINT}"
# Store the prepared NETWORK_ENDPOINT in an environment variable
echo "NETWORK_ENDPOINT=${NETWORK_ENDPOINT}" >> $GITHUB_ENV
echo "NETWORK_ENDPOINT=${NETWORK_ENDPOINT}" >> $GITHUB_ENV
- name: Install Docker inside the container
run: |
apt-get update
apt-get install -y docker.io
apt-get install -y docker.io
- name: Install PostgreSQL client
run: |
Expand Down Expand Up @@ -176,15 +175,14 @@ jobs:
name: benchmark-${{steps.current-time.outputs.formattedTime}}-${{steps.query_meta.outputs.indexer_version}}
path: output/benchmark/


- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# channel for sq-benchmark
channel-id: 'C05JF51F1MJ'
channel-id: "C05JF51F1MJ"
# For posting a rich message using Block Kit
payload: |
{
Expand All @@ -201,4 +199,3 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

- run: yarn install

Expand Down
90 changes: 45 additions & 45 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR
on:
pull_request:
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"
jobs:
code-style:
name: code-style
Expand All @@ -12,53 +12,53 @@ jobs:
SUBQL_ACCESS_TOKEN_TEST: ${{ secrets.SUBQL_ACCESS_TOKEN_TEST }}
SUBQL_ORG_TEST: ${{ secrets.SUBQL_ORG_TEST }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
- run: yarn
- name: build
run: yarn build
- name: code-style check
run: yarn pretty-quick --check --pattern 'packages/*/src/**/*' --branch origin/main
- name: lint
run: yarn lint
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
- run: yarn
- name: build
run: yarn build
- name: code-style check
run: yarn pretty-quick --check --pattern 'packages/*/src/**/*' --branch origin/main
- name: lint
run: yarn lint

coverage:
name: Coverage report
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
name: Coverage report
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
steps:
- uses: actions/checkout@v4
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
steps:
- uses: actions/checkout@v4

- name: Use Node 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Use Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Installing dependencies
run: yarn install
- name: Installing dependencies
run: yarn install

- uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: install
working-directory: ${{ matrix.path }}
test-script: yarn test-jest
annotations: none
- uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: install
working-directory: ${{ matrix.path }}
test-script: yarn test-jest
annotations: none
6 changes: 3 additions & 3 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"

concurrency:
group: publish
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

- uses: marceloprado/has-changed-path@v1
id: changed-types-starknet
Expand Down Expand Up @@ -71,6 +71,6 @@ jobs:
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
message: '[SKIP CI] Prerelease'
message: "[SKIP CI] Prerelease"
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"
workflow_dispatch:

concurrency:
Expand All @@ -13,7 +13,6 @@ concurrency:
cancel-in-progress: false

jobs:

# This gets the commit message because workflow dispatch doesnt set: github.event.head_commit.message
pre-ci:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -50,9 +49,9 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

#Identify changes
#Identify changes
- uses: marceloprado/has-changed-path@v1
id: changed-types-starknet
with:
Expand Down
48 changes: 23 additions & 25 deletions .github/workflows/sync-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,29 @@ jobs:
SUBQL_ACCESS_TOKEN_TEST: ${{ secrets.SUBQL_ACCESS_TOKEN_TEST }}
SUBQL_ORG_TEST: ${{ secrets.SUBQL_ORG_TEST }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
- run: yarn

# Update deps
- name: Update types
run: yarn --cwd ./packages/types add @subql/types-core
- name: Update common
run: yarn --cwd ./packages/common-starknet add @subql/common
- name: Update node
run: yarn --cwd ./packages/node add @subql/common @subql/node-core

- name: Determine branch name
id: branch-name
run: echo "branch=sync-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- uses: peter-evans/create-pull-request@v5
with:
branch: ${{ steps.branch-name.outputs.branch }}
commit-message: "Update @subql deps"
token: ${{ secrets.SQ_SDK_GITHUB_SECRET }}
title: 'Sync @subql dependencies'
body-file: '.github/PULL_REQUEST_TEMPLATE.md'
# Update deps
- name: Update types
run: yarn --cwd ./packages/types add @subql/types-core
- name: Update common
run: yarn --cwd ./packages/common-starknet add @subql/common
- name: Update node
run: yarn --cwd ./packages/node add @subql/common @subql/node-core

- name: Determine branch name
id: branch-name
run: echo "branch=sync-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- uses: peter-evans/create-pull-request@v5
with:
branch: ${{ steps.branch-name.outputs.branch }}
commit-message: "Update @subql deps"
token: ${{ secrets.SQ_SDK_GITHUB_SECRET }}
title: "Sync @subql dependencies"
body-file: ".github/PULL_REQUEST_TEMPLATE.md"
2 changes: 1 addition & 1 deletion packages/common-starknet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Changed
- Update `@subql/common` (#21)
- Update `@subql/common` (#23)

## [1.0.2] - 2025-02-03
### Fixed
Expand Down
Loading

0 comments on commit b675499

Please sign in to comment.