-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup test on ci, fix roi calculator (#21)
- Loading branch information
1 parent
4ea31fe
commit 78a8619
Showing
8 changed files
with
574 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: ["master"] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
SUBSCAN_KEY: ${{ secrets.SUBSCAN_KEY }} | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Install: NodeJS 20.x" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: "Install: pkg dependencies" | ||
run: yarn install | ||
|
||
- name: "Run server" | ||
env: | ||
SUBSCAN_KEY: ${{ secrets.SUBSCAN_KEY }} | ||
NETWORK_ADDRESSES: "wss://rpc.vara.network" | ||
run: nohup yarn start & | ||
|
||
- name: "Run tests" | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const endpoints = ['/api/burned', '/api/total', '/api/total-vesting', '/api/circulating-supply', '/api/roi']; | ||
|
||
const test = async () => { | ||
for (const endpoint of endpoints) { | ||
const res = await fetch(new URL(endpoint, 'http://127.0.0.1:3000')); | ||
|
||
if (!res.ok) { | ||
throw new Error(`Failed to fetch ${endpoint}`); | ||
} | ||
|
||
const data = await res.text(); | ||
|
||
if (Number(data) === NaN) { | ||
throw new Error(`Failed to parse ${endpoint}. ${data}`); | ||
} | ||
|
||
console.log(endpoint, '- ok'); | ||
} | ||
}; | ||
|
||
test() | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}) | ||
.then(() => process.exit(0)); |
Oops, something went wrong.