-
Notifications
You must be signed in to change notification settings - Fork 68
200 lines (175 loc) · 6.99 KB
/
Copy pathtest-server.yml
File metadata and controls
200 lines (175 loc) · 6.99 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Separate from the library CI (ci.yml) so the test-server directory is not
# swept into the coverage-gated library jobs.
name: ESDK TestServer (Node.js)
on:
pull_request:
paths:
- "test-server/**"
- ".github/workflows/test-server.yml"
push:
paths:
- "test-server/**"
- ".github/workflows/test-server.yml"
workflow_dispatch:
permissions:
contents: read
jobs:
javascript-language-server:
name: build + test (live modules)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --unsafe-perm
- name: Build modules
run: npm run build-node
- name: Build server
working-directory: test-server
run: npx tsc -p tsconfig.json
- name: Test server
working-directory: test-server
run: npm test
# The complete cross-language TestServer run: `make test-server` clones commons and
# the orchestrator materializes + builds + launches every configured Language_Server
# (this working tree is the live server), runs the full pairwise matrix, and tears
# down. Provisions the full toolchain matrix + the commons build caches. Needs the
# COMMONS_REPO_PAT secret (read on commons + java + rust).
test-server:
name: Cross-language TestServer run
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
AWS_REGION: us-west-2
GRADLE_OPTS: -Dorg.gradle.daemon=false
# Cold builds (Java gradle/maven, Rust aws-lc-sys, .NET dafny transpile) exceed
# the orchestrator's 180s default server-readiness window; widen it so the first
# (cold-cache) run fits. Warm runs are fast via the build caches above.
ESDK_TESTSERVER_READY_TIMEOUT_SECONDS: "1800"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up JDK 17 (Temurin) — exposes JAVA_HOME_17_X64 for the MPL stub jar
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Set up JDK 21 (Temurin) — the commons orchestrator (smithy-java) needs 21+
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Set up Python 3.11 (the materialized Python Language_Server needs >=3.11)
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up Node.js 22 (the materialized JavaScript Language_Server build needs 17+)
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Set up Go (Go Language_Server + the Rust servers' aws-lc-sys native builds)
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Set up the Rust toolchain (Rust Language_Server builds)
run: |
set -euo pipefail
rustup toolchain install stable --profile minimal
rustup default stable
cargo --version
- name: Set up .NET (the materialized .NET Language_Server build)
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install Dafny 4.9.0 (the .NET library transpile in the materialized clone)
run: |
set -euo pipefail
dotnet tool install --global dafny --version 4.9.0
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
"$HOME/.dotnet/tools/dafny" --version
- name: Build aws-c-common (the materialized C Language_Server cmake requires it)
run: |
set -euo pipefail
git clone --depth 1 https://github.com/awslabs/aws-c-common "$RUNNER_TEMP/aws-c-common"
cmake -S "$RUNNER_TEMP/aws-c-common" -B "$RUNNER_TEMP/aws-c-common-build" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/.aws-c-common-install" \
-DBUILD_TESTING=OFF
cmake --build "$RUNNER_TEMP/aws-c-common-build" --target install -- -j
echo "CMAKE_PREFIX_PATH=${{ github.workspace }}/.aws-c-common-install" >> "$GITHUB_ENV"
- name: Restore build caches (Gradle/Maven/Cargo/NuGet/Go/npm)
uses: actions/cache/restore@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
~/.cargo/registry
~/.cargo/git
~/.nuget/packages
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: ${{ runner.os }}-esdk-ts-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-esdk-ts-build-
- name: Install stub for the unpublished MPL test-vectors artifact
# The materialized Java Language_Server build runs `mvn install`, which
# resolves a test-scope MPL artifact (TestAwsCryptographicMaterialProviders)
# that is not on Maven Central; a stub jar satisfies resolution (tests skip).
run: |
set -euo pipefail
tmp="$(mktemp -d)"
echo placeholder > "$tmp/README.txt"
"$JAVA_HOME_17_X64/bin/jar" cf "$tmp/stub.jar" -C "$tmp" README.txt
mvn -q -e org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile="$tmp/stub.jar" \
-DgroupId=software.amazon.cryptography \
-DartifactId=TestAwsCryptographicMaterialProviders \
-Dversion=1.7.0 \
-Dpackaging=jar
- name: Authenticate the private clones (commons, java, rust)
env:
PAT: ${{ secrets.COMMONS_REPO_PAT }}
run: |
test -n "$PAT" || { echo "::error::COMMONS_REPO_PAT is empty/unset in this repo"; exit 1; }
git config --global url."https://x-access-token:${PAT}@github.com/".insteadOf "git@github.com:"
- name: Configure AWS credentials via OIDC (required KMS scenarios)
id: aws-credentials
continue-on-error: true
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.ESDK_TEST_SERVER_KMS_ROLE_ARN || 'arn:aws:iam::370957321024:role/esdk-test-server-ci-kms-role' }}
aws-region: us-west-2
- name: Verify AWS credentials are active (gates the orchestrated run)
run: |
if ! aws sts get-caller-identity; then
echo "::error::No usable AWS credentials for the required KMS scenarios." >&2
exit 1
fi
- name: Run the orchestrated TestServer
working-directory: test-server
run: make test-server
- name: Save build caches
if: always()
uses: actions/cache/save@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
~/.cargo/registry
~/.cargo/git
~/.nuget/packages
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: ${{ runner.os }}-esdk-ts-build-${{ github.run_id }}