Skip to content

Commit

Permalink
feat: added first version of the package
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsc0x committed Oct 8, 2024
1 parent d5e3f56 commit aa8ecd9
Show file tree
Hide file tree
Showing 70 changed files with 15,578 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/gen-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy documentation

on:
push:
tags:
- v*

jobs:
deploy-typedoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Generate doc
run: |
npm ci
npm run doc
mv docs/documentation/html aave-v3-aptos-ts-sdk
- name: Deploy files
uses: appleboy/scp-action@master
with:
host: ${{ secrets.AAVEDOC_HOST }}
username: ${{ secrets.AAVEDOC_USERNAME }}
key: ${{ secrets.AAVEDOC_SSHKEY }}
source: "./aave-v3-aptos-ts-sdk"
target: "/var/www/type-doc"
29 changes: 29 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm run fmt:check
- run: npm test
22 changes: 22 additions & 0 deletions .github/workflows/npm-publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Npm nightly publish

on:
push:
branches: [main, buildnet]

jobs:
test:
uses: ./.github/workflows/node.js.yml

publish-npm-dev:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: ./scripts/publish-dev.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
36 changes: 36 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: NPM Publish

on:
release:
types: [created]

jobs:
test:
uses: ./.github/workflows/node.js.yml

publish-npm:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Extract tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
env:
GITHUB_REF: ${{ github.ref }}

- run: ./scripts/publish.sh ${{ steps.get_tag.outputs.TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

- uses: softprops/action-gh-release@v1
with:
files: |
bundle.js
bundle.min.js
43 changes: 43 additions & 0 deletions .github/workflows/test-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Borrow Example

on:
push:
branches:
- main

jobs:
deploy-SC-example:
defaults:
run:
working-directory: ./examples/

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Deploy
run: |
echo ${{ secrets.JSON_RPC_URL_PUBLIC }}
if npm run test-borrow-example ; then
echo "Borrow example passed!"
else
echo "Failed to run borrow example ..."
exit 1
fi
env:
JSON_RPC_URL_PUBLIC: https://testnet.aptos.net/api/v2
65 changes: 65 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Unit tests

on:
push:
workflow_call:

jobs:
build:

runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/298#issuecomment-664976337
ref: ${{ github.head_ref }}
# Checkout code using bot account
token: ${{ github.token }}

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'

- name: Execute unit tests
run: |
npm ci
npm run build
npm run fmt:check
npm run test
- name: allow access to coverage.sh
run: chmod +x ./scripts/coverage.sh
shell: bash

- name: Extract coverage
id: coverage
run: |
value=$(npm run test:cov | awk '/All files/ {print $10}' | tr -d '%')
echo "coverage=$value" >> $GITHUB_OUTPUT
- name: Add test coverage to README
run: ./scripts/coverage.sh
shell: bash
env:
COVERAGE: ${{ steps.coverage.outputs.coverage }}

- name: Check if coverage changed
id: check_coverage_changed
run: |
echo "::set-output name=coverage_changed::$(git diff --name-only README.md | grep -E '^README.md$')"
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.ref == 'refs/heads/main' && steps.check_coverage_changed.outputs.coverage_changed != '' }}
with:
commit_message: "Generate coverage badge"
file_pattern: "README.md"
commit_author: Aaave <[email protected]>
76 changes: 76 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# build folder
dist/

# bundle files
bundle.*

# docs files
docs

#.env files
.env

# Misc
.DS_Store
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run fmt:check
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts,jsx,tsx,json,cjs}": ["npx eslint"],
"*.ts": ["npx as-prettier --check"]
}
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
src/
test/
tsconfig.json
tslint.json
.npmrc
.vs/
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
build
node_modules
.github
bundle.*
docs
dist
*.json
.lintstagedrc
README.md
*.html
*.md
coverage
*.yaml
*.lock
Loading

0 comments on commit aa8ecd9

Please sign in to comment.