Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added scripts, more funcs, improvements, ts-documentation #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: npm audit

on:
pull_request:
merge_group:
branches:
- fixes/evgeni/various
schedule:
- cron: '0 10 * * *'

jobs:
npm-scan:
name: ts-sdk npm audit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Enable Corepack
run: corepack enable

- name: Get PNPM store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Run pnpm audit
run: pnpm audit
56 changes: 40 additions & 16 deletions .github/workflows/gen-deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,51 @@ name: Deploy documentation

on:
push:
tags:
- v*
branches:
- fixes/evgeni/various
workflow_dispatch:

jobs:
deploy-typedoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
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

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
host: ${{ secrets.AAVEDOC_HOST }}
username: ${{ secrets.AAVEDOC_USERNAME }}
key: ${{ secrets.AAVEDOC_SSHKEY }}
source: "./aave-v3-aptos-ts-sdk"
target: "/var/www/type-doc"
version: 9
run_install: false

- name: Enable Corepack
run: corepack enable

- name: Get PNPM store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Install gh-pages globally
run: pnpm add -g gh-pages

- name: Publish github pages
run: |
npx gh-pages -d dist -u "github-actions-bot <[email protected]>"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
53 changes: 40 additions & 13 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,56 @@
# 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:
workflow_dispatch:

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/
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm run fmt:check
- run: npm test

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Enable Corepack
run: corepack enable

- name: Get PNPM store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Format Check
run: pnpm run fmt:check

- name: Run Tests
run: pnpm test
22 changes: 0 additions & 22 deletions .github/workflows/npm-publish-dev.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
Expand All @@ -32,5 +33,5 @@ jobs:
- uses: softprops/action-gh-release@v1
with:
files: |
bundle.js
bundle.min.js
dist/bundle.js
dist/bundle.min.js
34 changes: 25 additions & 9 deletions .github/workflows/test-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
deploy-SC-example:
tes-api-example:
defaults:
run:
working-directory: ./examples/
Expand All @@ -15,25 +15,41 @@ jobs:

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

- name: Install node
uses: actions/setup-node@v3
- name: Install PNPM
run: npm install -g pnpm

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

- name: Enable Corepack
run: corepack enable

- name: Get PNPM store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: npm install
run: pnpm install --frozen-lockfile

- name: Build
run: npm run build
run: pnpm run build

- name: Deploy
run: |
echo ${{ secrets.JSON_RPC_URL_PUBLIC }}
if npm run test-borrow-example ; then
if pnpm run test-borrow-example ; then
echo "Borrow example passed!"
else
echo "Failed to run borrow example ..."
Expand Down
48 changes: 34 additions & 14 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,45 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
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
- name: Set Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Enable Corepack
run: corepack enable

- name: Get PNPM store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Execute unit tests
run: |
npm ci
npm run build
npm run fmt:check
npm run test
pnpm run build
pnpm run fmt:check
pnpm run test

- name: allow access to coverage.sh
run: chmod +x ./scripts/coverage.sh
Expand All @@ -42,12 +62,12 @@ jobs:
- name: Extract coverage
id: coverage
run: |
value=$(npm run test:cov | awk '/All files/ {print $10}' | tr -d '%')
value=$(pnpm 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
run: ./scripts/coverage.sh
shell: bash
env:
COVERAGE: ${{ steps.coverage.outputs.coverage }}

Expand All @@ -62,4 +82,4 @@ jobs:
with:
commit_message: "Generate coverage badge"
file_pattern: "README.md"
commit_author: Aaave <[email protected]>
commit_author: Aave <[email protected]>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copyright (c) 2024 Aave. All Rights Reserved.
Copyright (c) 2025 Aave Labs. All Rights Reserved.
Loading
Loading