-
Notifications
You must be signed in to change notification settings - Fork 16
176 lines (160 loc) · 6.22 KB
/
test_ci.yml
File metadata and controls
176 lines (160 loc) · 6.22 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: "Test: CI"
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
audit:
name: "Audit Dependencies"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- run: pnpm audit --audit-level=moderate
prepublish:
name: "Build NPM Packages"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- run: pnpm packages:prepublish
static-analysis:
name: "Static Analysis"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- name: Run Biome CI
run: pnpm lint:ci
- name: Run TypeScript Typecheck
run: pnpm typecheck
- name: Check Terraform Format
run: terraform fmt -recursive -check -diff
unit-tests:
name: "Unit Tests"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- run: pnpm test
openapi-sync-check:
name: "OpenAPI Spec Sync Check"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- name: Generate OpenAPI spec
run: pnpm generate:openapi
- name: Verify spec is in sync
run: |
SPEC_PATH="docs/docs.ensnode.io/ensapi-openapi.json"
# First, ensure the spec file exists and is tracked by git.
if ! git ls-files --error-unmatch "$SPEC_PATH" >/dev/null 2>&1; then
echo "Error: OpenAPI spec file is missing or untracked: $SPEC_PATH"
echo ""
echo "Git status for the spec file (if any):"
git status --porcelain "$SPEC_PATH" || true
echo ""
echo "To fix, run: pnpm generate:openapi"
echo "Then add and commit the generated ensapi-openapi.json."
exit 1
fi
# Then, ensure the committed spec matches what the code generates.
if ! git diff --quiet "$SPEC_PATH"; then
echo "Error: OpenAPI spec is out of sync"
echo ""
echo "The committed ensapi-openapi.json differs from what the code generates:"
echo ""
git diff --color "$SPEC_PATH"
echo ""
echo "To fix, run: pnpm generate:openapi"
echo "Then commit the updated ensapi-openapi.json."
exit 1
fi
echo "OpenAPI spec is in sync with codebase"
- name: Validate OpenAPI spec with Mintlify
run: pnpm dlx --allow-build=keytar mint@^4.1.0 openapi-check docs/docs.ensnode.io/ensapi-openapi.json
graphql-schema-check:
name: "GraphQL Schema Check"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- name: Generate Schemas & Typings
run: pnpm generate:gqlschema
- name: Verify generated files are committed
run: |
if ! git diff --quiet packages/enssdk/src/omnigraph/generated/; then
echo "Error: Generated files are out of sync"
echo ""
echo "The following generated files differ from what is committed:"
git diff --name-status packages/enssdk/src/omnigraph/generated/
echo ""
echo "To fix, run:"
echo " pnpm generate:gqlschema"
echo "Then commit the updated generated files."
exit 1
fi
echo "GraphQL schema generated files are in sync"
integrity-check:
name: "Integrity Check"
runs-on: blacksmith-4vcpu-ubuntu-2204
services:
# run postgres alongside this job
postgres:
image: postgres:17
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
# This will run the dev command in background, and wait up to
# HEALTH_CHECK_TIMEOUT seconds. It will monitor the log output to
# ensure the app healthcheck is live. If the command does not
# print the log with the healthcheck message within that time, the step
# will exit with a failure.
# This runtime check uses an ephemeral postgres database that only lives in the CI
# environment. It will be discarded after the CI run. The app will not
# check anything beyond the healthcheck as its job is to ensure the app
# starts successfully only. With the configured RPCs there is likely to
# be rate limits hit. To prevent that, we use private RPC URLs from
# GitHub Secrets.
- name: Run ENSIndexer runtime integrity checks
env:
# Note on managing below configuration with GitHub:
# We use private RPC URLs from GitHub Secrets to avoid rate limits.
# Public RPC URLs are used as fallbacks for repository forks
# that don't have the relevant secrets configured.
NAMESPACE: mainnet
ENSDB_URL: postgresql://postgres:password@localhost:5432/postgres
ENSINDEXER_SCHEMA_NAME: ensindexer_test_ci
PLUGINS: subgraph,basenames,lineanames,threedns,protocol-acceleration,registrars,tokenscope
ENSRAINBOW_URL: https://api.ensrainbow.io
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
QUICKNODE_API_KEY: ${{ secrets.QUICKNODE_API_KEY }}
QUICKNODE_ENDPOINT_NAME: ${{ secrets.QUICKNODE_ENDPOINT_NAME}}
# healthcheck script env variables
HEALTH_CHECK_TIMEOUT: 60
run: ./.github/scripts/run_ensindexer_healthcheck.sh
integration-tests:
name: "Integration Tests"
runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup_node_environment
- name: Run integration tests
run: pnpm test:integration:ci