-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run TS SDK tests against local testnets built from prod branches, spl…
…it API checks into separate job
- Loading branch information
Showing
9 changed files
with
369 additions
and
115 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,43 @@ | ||
name: "Run Local Testnet" | ||
description: | | ||
Runs a local testnet from a Docker image built from a particular image tag | ||
inputs: | ||
IMAGE_TAG: | ||
description: "The image tag to use for running the local testnet, e.g. devnet / testnet / mainnet or some SHA" | ||
required: true | ||
GCP_DOCKER_ARTIFACT_REPO: | ||
description: "The GCP Docker artifact repository" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# Create a directory that we'll bindmount into the container into which it can | ||
# store all its configuration and files. | ||
- name: Create directory for testnet files | ||
run: mkdir -p ${{ runner.temp }}/testnet | ||
shell: bash | ||
|
||
# Run a local testnet. We mount in the testnet directory we just created. | ||
- run: docker run -p 8080:8080 -p 8081:8081 -v ${{ runner.temp }}/testnet:/testnet --name=local-testnet-${{ inputs.IMAGE_TAG }} --detach ${{ inputs.GCP_DOCKER_ARTIFACT_REPO }}/tools:${{ inputs.IMAGE_TAG }} aptos node run-local-testnet --with-faucet --test-dir /testnet | ||
shell: bash | ||
|
||
# Install node + npm. | ||
- uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b # pin@v3 | ||
with: | ||
node-version-file: .node-version | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
# Wait for the node API and faucet of the local testnet to start up. | ||
- run: npm install -g wait-on | ||
shell: bash | ||
- run: wait-on -t 60000 --httpTimeout 60000 http-get://127.0.0.1:8080/v1 | ||
shell: bash | ||
- run: wait-on -t 60000 --httpTimeout 60000 http-get://127.0.0.1:8081 | ||
shell: bash | ||
|
||
# Print the logs from the local testnet if the tests failed. | ||
- name: Print local testnet logs if something failed | ||
run: docker logs local-testnet-${{ inputs.IMAGE_TAG }} | ||
shell: bash | ||
if: ${{ failure() }} |
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,24 @@ | ||
name: "Run Rust Node Client Tests" | ||
description: | | ||
Run the Rust Node Client (aptos-rest-client) tests against a local testnet built from a particular release branch | ||
inputs: | ||
NETWORK: | ||
description: "The network to use for running the local testnet, one of devnet / testnet / mainnet" | ||
required: true | ||
GCP_DOCKER_ARTIFACT_REPO: | ||
description: "The GCP Docker artifact repository" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# Run a local testnet. | ||
- uses: ./.github/actions/run-local-testnet | ||
with: | ||
IMAGE_TAG: ${{ inputs.NETWORK }} | ||
GCP_DOCKER_ARTIFACT_REPO: ${{ inputs.GCP_DOCKER_ARTIFACT_REPO }} | ||
|
||
# Run the tests. | ||
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main | ||
- run: cargo run -p aptos-rest-client --example account -- --api-url 'http://127.0.0.1:8080/v1' | ||
shell: bash |
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,65 @@ | ||
name: "Run SDK E2E tests" | ||
description: | | ||
Run the SDK E2E tests against a local testnet built from a particular release branch | ||
inputs: | ||
NETWORK: | ||
description: "The network to use for running the local testnet, one of devnet / testnet / mainnet" | ||
required: true | ||
GCP_DOCKER_ARTIFACT_REPO: | ||
description: "The GCP Docker artifact repository" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# Install node and pnpm. | ||
- uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b # pin@v3 | ||
with: | ||
node-version-file: .node-version | ||
registry-url: "https://registry.npmjs.org" | ||
- uses: pnpm/action-setup@537643d491d20c2712d11533497cb47b2d0eb9d5 # pin https://github.com/pnpm/action-setup/releases/tag/v2.2.3 | ||
|
||
# Set up the necessary env vars for the test suite. | ||
- run: echo "APTOS_NODE_URL=http://127.0.0.1:8080/v1" >> .env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
- run: echo "APTOS_FAUCET_URL=http://127.0.0.1:8081" >> .env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
- run: echo "ANS_TEST_ACCOUNT_PRIVATE_KEY=0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221" >> .env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
- run: echo "ANS_TEST_ACCOUNT_ADDRESS=585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82" >> .env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
- run: echo "DOCKER_IMAGE=${{ inputs.GCP_DOCKER_ARTIFACT_REPO }}/tools:${{ inputs.NETWORK }}" >>.env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
- run: echo "NETWORK=${{ inputs.NETWORK }}" >> .env | ||
shell: bash | ||
working-directory: ./ecosystem/typescript/sdk | ||
|
||
# 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 | ||
working-directory: ./ecosystem/typescript/sdk | ||
|
||
# Run a local testnet. | ||
- uses: ./.github/actions/run-local-testnet | ||
with: | ||
IMAGE_TAG: ${{ inputs.NETWORK }} | ||
GCP_DOCKER_ARTIFACT_REPO: ${{ inputs.GCP_DOCKER_ARTIFACT_REPO }} | ||
|
||
# Run the TS SDK tests. | ||
- uses: nick-fields/retry@7f8f3d9f0f62fe5925341be21c2e8314fd4f7c7c # pin@v2 | ||
name: sdk-pnpm-test | ||
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 }} | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 25 | ||
command: cd ./ecosystem/typescript/sdk && pnpm run test:ci |
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,71 @@ | ||
# Each of these jobs runs the Rust SDK client tests from this commit against a local | ||
# testnet built from one of the production release branches. In other words, we run the | ||
# tests against a local devnet, testnet, and mainnet. | ||
|
||
name: "Rust SDK Client Tests" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-tests-devnet: | ||
runs-on: high-perf-docker | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3 | ||
- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main | ||
with: | ||
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
GCP_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DOCKER_ARTIFACT_REPO: ${{ secrets.AWS_DOCKER_ARTIFACT_REPO }} | ||
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} | ||
- uses: ./.github/actions/run-rust-client-tests | ||
with: | ||
NETWORK: devnet | ||
GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} | ||
|
||
run-tests-testnet: | ||
runs-on: high-perf-docker | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3 | ||
- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main | ||
with: | ||
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
GCP_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DOCKER_ARTIFACT_REPO: ${{ secrets.AWS_DOCKER_ARTIFACT_REPO }} | ||
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} | ||
- uses: ./.github/actions/run-rust-client-tests | ||
with: | ||
NETWORK: testnet | ||
GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} | ||
|
||
run-tests-mainnet: | ||
runs-on: high-perf-docker | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3 | ||
- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main | ||
with: | ||
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
GCP_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DOCKER_ARTIFACT_REPO: ${{ secrets.AWS_DOCKER_ARTIFACT_REPO }} | ||
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} | ||
- uses: ./.github/actions/run-rust-client-tests | ||
with: | ||
NETWORK: mainnet | ||
GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} |
Oops, something went wrong.