Skip to content

Commit

Permalink
Merge pull request #237 from hirosystems/develop
Browse files Browse the repository at this point in the history
release to beta
  • Loading branch information
rafaelcr authored Aug 21, 2024
2 parents 1aa1603 + 2ddb2c7 commit 5eeea44
Show file tree
Hide file tree
Showing 78 changed files with 4,458 additions and 16,111 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ module.exports = {
ecmaVersion: 2020,
sourceType: 'module',
},
ignorePatterns: ['*.config.js', 'config/*', '*.mjs', 'tests/*.js', 'client/*'],
ignorePatterns: [
'*.config.js',
'config/*',
'*.mjs',
'tests/**/*.js',
'client/*',
'coverage/*',
'dist/*',
],
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'prettier'],
rules: {
'prettier/prettier': 'error',
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -49,10 +49,15 @@ jobs:
run: npm run lint:prettier

test:
strategy:
fail-fast: false
matrix:
suite: [admin, api, chainhook, token-queue]
runs-on: ubuntu-latest
env:
API_HOST: 127.0.0.1
API_PORT: 3000
PROMETHEUS_PORT: 9154
PGHOST: 127.0.0.1
PGPORT: 5432
PGUSER: postgres
Expand All @@ -66,7 +71,7 @@ jobs:
STACKS_NODE_RPC_HOST: 127.0.0.1
STACKS_NODE_RPC_PORT: 24440
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -76,7 +81,7 @@ jobs:
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -99,10 +104,12 @@ jobs:
npm run testenv:logs -- --no-color &> docker-compose-logs.txt &
- name: Run tests
run: npm run test -- --coverage
run: npm run test:${{ matrix.suite }} -- --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Print integration environment logs
run: cat docker-compose-logs.txt
Expand All @@ -118,14 +125,14 @@ jobs:
- lint
- test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v4
id: semantic
# Only run on non-PR events or only PRs that aren't from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
64 changes: 64 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,69 @@
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
{
"type": "node",
"request": "launch",
"name": "Jest: Admin",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
"${workspaceFolder}/tests/admin/"
],
"outputCapture": "std",
"console": "integratedTerminal",
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
{
"type": "node",
"request": "launch",
"name": "Jest: API",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
"${workspaceFolder}/tests/api/"
],
"outputCapture": "std",
"console": "integratedTerminal",
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
{
"type": "node",
"request": "launch",
"name": "Jest: Chainhook",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
"${workspaceFolder}/tests/chainhook/",
],
"outputCapture": "std",
"console": "integratedTerminal",
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
{
"type": "node",
"request": "launch",
"name": "Jest: Token Queue",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
"${workspaceFolder}/tests/token-queue/"
],
"outputCapture": "std",
"console": "integratedTerminal",
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:20-alpine

WORKDIR /app
COPY . .
Expand Down
147 changes: 0 additions & 147 deletions config/image-cache.js

This file was deleted.

2 changes: 1 addition & 1 deletion docker/docker-compose.dev.postgres.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
postgres:
image: "postgres:14"
image: "postgres:15"
ports:
- "5432:5432"
environment:
Expand Down
25 changes: 17 additions & 8 deletions migrations/1670264425574_smart-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,37 @@ export function up(pgm: MigrationBuilder): void {
principal: {
type: 'text',
notNull: true,
unique: true,
},
sip: {
type: 'sip_number',
notNull: true,
},
abi: {
type: 'jsonb',
token_count: {
type: 'numeric',
},
fungible_token_name: {
type: 'text',
},
non_fungible_token_name: {
type: 'text',
},
block_height: {
type: 'int',
notNull: true,
},
index_block_hash: {
type: 'text',
notNull: true,
},
tx_id: {
type: 'text',
notNull: true,
},
block_height: {
tx_index: {
type: 'int',
notNull: true,
},
token_count: {
type: 'numeric',
},
created_at: {
type: 'timestamptz',
default: pgm.func('(NOW())'),
Expand All @@ -42,7 +53,5 @@ export function up(pgm: MigrationBuilder): void {
type: 'timestamptz',
},
});
pgm.createConstraint('smart_contracts', 'smart_contracts_principal_unique', 'UNIQUE(principal)');
pgm.createIndex('smart_contracts', [{ name: 'block_height', sort: 'DESC' }]);
pgm.createIndex('smart_contracts', ['principal']);
}
Loading

0 comments on commit 5eeea44

Please sign in to comment.