forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (93 loc) · 4.3 KB
/
ts-sdk-e2e-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Each of these jobs runs the TS SDK E2E tests from this commit against a local testnet
# built from one of the production release branches. In other words, we run the TS SDK
# tests against a local devnet, testnet, and mainnet. We also run the TS SDK tests for
# the indexer, though those run against the production indexer for now.
env:
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
name: "TS SDK E2E Tests"
on:
pull_request_target:
types: [labeled, opened, synchronize, reopened, auto_merge_enabled]
push:
branches:
- main
permissions:
contents: read
id-token: write # Required for GCP Workload Identity federation which we use to login into Google Artifact Registry
jobs:
# Note on the job-level `if` conditions:
# This workflow is designed such that we run subsequent jobs only when a 'push'
# triggered the workflow or on 'pull_request's which have set auto_merge=true
# or have the label "CICD:run-e2e-tests".
permission-check:
runs-on: ubuntu-latest
steps:
- name: Check repository permission for user which triggered workflow
uses: sushichop/action-repository-permission@13d208f5ae7a6a3fc0e5a7c2502c214983f0241c
with:
required-permission: write
comment-not-permitted: Sorry, you don't have permission to trigger this workflow.
# This job determines which files were changed
file_change_determinator:
needs: [permission-check]
runs-on: ubuntu-latest
outputs:
only_docs_changed: ${{ steps.determine_file_changes.outputs.only_docs_changed }}
steps:
- uses: actions/checkout@v3
- name: Run the file change determinator
id: determine_file_changes
uses: ./.github/actions/file-change-determinator
# This is a PR required job.
run-tests-main-branch:
needs: [permission-check, file_change_determinator]
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
ref: ${{ env.GIT_SHA }}
- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
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-ts-sdk-e2e-tests
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
BRANCH: main
GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }}
- run: echo "Skipping the tests on the main branch! Unrelated changes detected."
if: needs.file_change_determinator.outputs.only_docs_changed == 'true'
# Run the TS SDK indexer tests. Note: Unlike the above tests where everything is self
# contained because we run a local testnet, these tests operate against the
# production indexer service. This service can be flaky so we don't want those tests
# to be land blocking for any PR on the aptos repo. This is why we run those tests
# separate from test-sdk-confirm-client-generated-publish.
run-indexer-tests:
if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests')
needs: [permission-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.GIT_SHA }}
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v2
# Run package install. If install fails, it probably means the lockfile
# was not included in the commit.
- run: cd ./ecosystem/typescript/sdk && pnpm install --frozen-lockfile
# Run indexer tests.
- uses: nick-fields/retry@7f8f3d9f0f62fe5925341be21c2e8314fd4f7c7c # pin@v2
name: ts-sdk-indexer-test
with:
max_attempts: 3
timeout_minutes: 20
command: cd ./ecosystem/typescript/sdk && pnpm run test:indexer