-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Add examples to the CI, and ensure linting and formatting …
…work correctly (#149) * [examples] Allow for running all examples at once with latest deps * [eslint] Add linter to examples * [examples] Fix lint errors in examples * [examples] Add examples running in CI This runs all of the tests against local testnet, while defaulting examples for users to devnet
- Loading branch information
1 parent
b46f29f
commit 884122c
Showing
20 changed files
with
986 additions
and
103 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
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,58 @@ | ||
name: "Run SDK examples" | ||
description: | | ||
Run the SDK Examples tests against local testnet | ||
runs: | ||
using: composite | ||
steps: | ||
# Install node and pnpm. | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .node-version | ||
registry-url: "https://registry.npmjs.org" | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.9.0 | ||
|
||
# Run package install. If install fails, it probably means the updated lockfile was | ||
# not included in the commit. | ||
- run: pnpm install --frozen-lockfile | ||
shell: bash | ||
# Build the SDk for use in the examples | ||
- run: pnpm build | ||
shell: bash | ||
|
||
# Install the CLI. | ||
- run: pnpm install -g @aptos-labs/aptos-cli | ||
shell: bash | ||
|
||
# Run a local testnet in the background. | ||
- run: aptos node run-local-testnet --force-restart --assume-yes --with-indexer-api --log-to-stdout >& ${{ runner.temp }}/local-testnet-logs.txt & | ||
shell: bash | ||
|
||
# Wait for the local testnet to be ready by hitting the readiness endpoint. | ||
# We give it a while because the CLI will have to download some images before | ||
# actually running the local testnet, which can take a while. | ||
- run: pnpm install -g wait-on | ||
shell: bash | ||
- run: wait-on --verbose --interval 1500 --timeout 120000 --httpTimeout 120000 http-get://127.0.0.1:8070 | ||
shell: bash | ||
|
||
# Change into the typescript examples folder | ||
- run: cd examples/typescript | ||
shell: bash | ||
|
||
# Run the examples | ||
- uses: nick-fields/retry@7f8f3d9f0f62fe5925341be21c2e8314fd4f7c7c # pin@v2 | ||
name: sdk-pnpm-examples | ||
env: | ||
# This is important, it ensures that the tempdir we create for cloning the ANS | ||
# repo and mounting it into the CLI container is created in a location that | ||
# actually supports mounting. Learn more here: https://stackoverflow.com/a/76523941/3846032. | ||
TMPDIR: ${{ runner.temp }} | ||
APTOS_NETWORK: local | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 25 | ||
# This runs all of the examples | ||
command: pnpm 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
env: | ||
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
name: "Run examples against local testnet" | ||
on: | ||
pull_request: | ||
types: [labeled, opened, synchronize, reopened, auto_merge_enabled] | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.GIT_SHA }} | ||
- uses: ./.github/actions/run-examples |
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 |
---|---|---|
|
@@ -11,6 +11,6 @@ | |
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"aptos": "link:../.." | ||
"@aptos-labs/ts-sdk": "link:../.." | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
auto-install-peers=true | ||
strict-peer-dependencies=false |
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
Oops, something went wrong.