From c2b10d037347a3512a48baf4733af865dbf0570a Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Mon, 27 Nov 2023 16:53:11 +0000 Subject: [PATCH 1/3] ci: add action to install and cache dependencies --- .github/actions/use-dependencies/action.yml | 22 +++++++++++++++++++ ...build_test.yml => pull_request_checks.yml} | 0 2 files changed, 22 insertions(+) create mode 100644 .github/actions/use-dependencies/action.yml rename .github/workflows/{lint_build_test.yml => pull_request_checks.yml} (100%) diff --git a/.github/actions/use-dependencies/action.yml b/.github/actions/use-dependencies/action.yml new file mode 100644 index 0000000..318ce7b --- /dev/null +++ b/.github/actions/use-dependencies/action.yml @@ -0,0 +1,22 @@ +name: "Use Dependencies" + +description: "Checks if the dependencies have been cached with the hash of the yarn.lock file." + +runs: + using: "composite" + steps: + - name: "๐Ÿ”ง Setup" + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + cache: 'yarn' + - name: "๐Ÿ’พ Cache dependencies" + uses: actions/cache@v3 + id: cache-dependencies + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }} + - name: "๐Ÿ“ฆ Install" + if: steps.cache-dependencies.outputs.cache-hit != 'true' + run: yarn install --ignore-scripts + shell: bash diff --git a/.github/workflows/lint_build_test.yml b/.github/workflows/pull_request_checks.yml similarity index 100% rename from .github/workflows/lint_build_test.yml rename to .github/workflows/pull_request_checks.yml From 3ed8dd93dd7b5930b3aee3012f8cdd430c408b59 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Mon, 27 Nov 2023 16:54:00 +0000 Subject: [PATCH 2/3] ci: update workflows to use new cached dependencies and use parrell jobs for pr checks --- .github/workflows/build_documentation.yml | 26 +++++++---- .github/workflows/deploy_documentation.yml | 2 +- .github/workflows/pull_request_checks.yml | 50 ++++++++++++++++++---- .github/workflows/release.yml | 30 +++++++++---- 4 files changed, 83 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index 8bc987b..1a8e3a9 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -1,20 +1,30 @@ -name: Build Documentation +name: "Build Documentation" on: pull_request: jobs: - build_documentation: - name: Build + ## + # install + ## + + install: + name: "Install" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + + build: + name: "Build" + needs: install runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v3 - name: "๐Ÿ”ง Setup" - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - - name: "๐Ÿ“ฆ Install" - run: yarn install --ignore-scripts + uses: ./.github/actions/use-dependencies - name: "๐Ÿ—๏ธ Build" run: yarn docs:build diff --git a/.github/workflows/deploy_documentation.yml b/.github/workflows/deploy_documentation.yml index 689e45b..fb2efe4 100644 --- a/.github/workflows/deploy_documentation.yml +++ b/.github/workflows/deploy_documentation.yml @@ -1,4 +1,4 @@ -name: Deploy Documentation +name: "Deploy Documentation" on: push: diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index 88a9e27..0c5ce1c 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -1,24 +1,58 @@ -name: Lint, Build & Test +name: "Pull Request Checks" on: pull_request: jobs: - lint_build_test: - name: Lint, Build & Test + ## + # install + ## + + install: + name: "Install" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + + ## + # lint, build and test + ## + + lint: + name: "Lint" + needs: install runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v3 - name: "๐Ÿ”ง Setup" - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - - name: "๐Ÿ“ฆ Install" - run: yarn install --ignore-scripts + uses: ./.github/actions/use-dependencies - name: "๐Ÿ‘• Lint" run: yarn lint + + build_chrome: + name: "Build" + needs: install + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies - name: "๐Ÿ—๏ธ Build" run: yarn build + + test: + name: "Test" + needs: install + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies - name: "๐Ÿงช Test" run: yarn test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f783690..0b52fea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: "Release" on: push: @@ -7,23 +7,37 @@ on: - main jobs: - release: - name: Release + ## + # install + ## + + install: + name: "Install" runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v3 - name: "๐Ÿ”ง Setup" - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' + uses: ./.github/actions/use-dependencies + + ## + # release + ## + + release: + name: "Release" + needs: install + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 - name: "๐Ÿ“ Create .npmrc" run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.PUBLISH_PUBLIC_PACKAGES_TOKEN }}" >> .npmrc echo "@agoralabs-sh:registry=https://registry.npmjs.org" >> .npmrc echo "access=public" >> .npmrc - - name: "๐Ÿ“ฆ Install" - run: yarn install --ignore-scripts + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies - name: "๐Ÿ—๏ธ Build" run: yarn build - name: "๐Ÿ”– Release" From bb8f79fb19b8345c0bc8496fc411914d4cbf2c7d Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Mon, 27 Nov 2023 17:10:52 +0000 Subject: [PATCH 3/3] chore: squash --- .github/workflows/build_documentation.yml | 30 ---------------------- .github/workflows/deploy_documentation.yml | 21 +++++++++------ .github/workflows/pull_request_checks.yml | 18 ++++++++++--- docs/api-reference/index.md | 6 ++--- docs/getting-started/index.md | 14 +++++----- src/errors/NetworkNotSupportedError.ts | 4 +-- 6 files changed, 40 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/build_documentation.yml diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml deleted file mode 100644 index 1a8e3a9..0000000 --- a/.github/workflows/build_documentation.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: "Build Documentation" - -on: - pull_request: - -jobs: - ## - # install - ## - - install: - name: "Install" - runs-on: ubuntu-latest - steps: - - name: "๐Ÿ›Ž Checkout" - uses: actions/checkout@v3 - - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies - - build: - name: "Build" - needs: install - runs-on: ubuntu-latest - steps: - - name: "๐Ÿ›Ž Checkout" - uses: actions/checkout@v3 - - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies - - name: "๐Ÿ—๏ธ Build" - run: yarn docs:build diff --git a/.github/workflows/deploy_documentation.yml b/.github/workflows/deploy_documentation.yml index fb2efe4..092f492 100644 --- a/.github/workflows/deploy_documentation.yml +++ b/.github/workflows/deploy_documentation.yml @@ -6,25 +6,30 @@ on: - main jobs: + install: + name: "Install" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + deploy: - name: Deploy + name: "Deploy" + needs: install runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v3 - name: "๐Ÿ”ง Setup" - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - cache: yarn - - name: "๐Ÿ“ฆ Install" - run: yarn install --ignore-scripts --frozen-lockfile + uses: ./.github/actions/use-dependencies - name: "๐Ÿ—๏ธ Build" run: yarn docs:build - name: "๐Ÿš€ Deploy" uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.WRITE_REPOS_TOKEN }} publish_dir: ./.docs user_name: agoralabs-bot user_email: tech@agoralabs.sh diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index 0c5ce1c..2133e26 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -18,7 +18,7 @@ jobs: uses: ./.github/actions/use-dependencies ## - # lint, build and test + # lint, build documentation, build package and test ## lint: @@ -33,8 +33,20 @@ jobs: - name: "๐Ÿ‘• Lint" run: yarn lint - build_chrome: - name: "Build" + build_documenation: + name: "Build Documentation" + needs: install + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v3 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + - name: "๐Ÿ—๏ธ Build" + run: yarn docs:build + + build_pakage: + name: "Build Package" needs: install runs-on: ubuntu-latest steps: diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index 50f8940..5d0e1ee 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -1,5 +1,5 @@ # API Reference -* [`AlgorandProvider`](algorand-provider) - injected as `window.algorand` by wallets and is used by dApps to interact with any installed wallets. -* [`BaseWalletManger`](base-wallet-manager) - the interface for wallets. -* [`Errors`](errors) - various error responses that can be thrown. +* [`AlgorandProvider`](api-reference/algorand-provider) - injected as `window.algorand` by wallets and is used by dApps to interact with any installed wallets. +* [`BaseWalletManger`](api-reference/base-wallet-manager) - the interface for wallets. +* [`Errors`](api-reference/errors) - various error responses that can be thrown. diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md index fd60367..a004238 100644 --- a/docs/getting-started/index.md +++ b/docs/getting-started/index.md @@ -4,15 +4,15 @@ For dApp developers. -* [Initialization](dapps/initialization) -* [Enabling a wallet](dapps/enabling-a-wallet) -* [Signing transactions](dapps/signing-transactions) -* [Sending transactions](dapps/sending-transactions) -* [Signing data](dapps/signing-data) +* [Initialization](getting-started/dapps/initialization) +* [Enabling a wallet](getting-started/dapps/enabling-a-wallet) +* [Signing transactions](getting-started/dapps/signing-transactions) +* [Sending transactions](getting-started/dapps/sending-transactions) +* [Signing data](getting-started/dapps/signing-data) ## Wallets For wallets. -* [Installation](wallets/installation) -* [Usage](wallets/usage) +* [Installation](getting-started/wallets/installation) +* [Usage](getting-started/wallets/usage) diff --git a/src/errors/NetworkNotSupportedError.ts b/src/errors/NetworkNotSupportedError.ts index 172d519..d244ca6 100644 --- a/src/errors/NetworkNotSupportedError.ts +++ b/src/errors/NetworkNotSupportedError.ts @@ -4,10 +4,10 @@ import { ErrorCodeEnum } from '../enums'; // Errors import BaseError from './BaseError'; -export default class NetworkNotSupported extends BaseError { +export default class NetworkNotSupportedError extends BaseError { public readonly code: ErrorCodeEnum = ErrorCodeEnum.NetworkNotSupportedError; public readonly genesisHash: string; - public readonly name: string = 'NetworkNotSupported'; + public readonly name: string = 'NetworkNotSupportedError'; constructor(genesisHash: string, message?: string) { super(