feat(test-server): add Node.js ESDK test server #11
This file contains hidden or 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
| # 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 the | |
| # commons repo and orchestrates the full matrix with this working tree as the | |
| # live JavaScript server. Runs on every pull_request/push; needs the | |
| # CI_AWS_ROLE_ARN and COMMONS_REPO_TOKEN repo secrets. | |
| test-server: | |
| name: Cross-language TestServer run | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| AWS_REGION: us-west-2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "npm" | |
| # The commons orchestrator (smithy-java) needs a JDK 21+ | |
| - name: Set up JDK 21 (Temurin) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Configure AWS credentials (branch-key-store account) | |
| 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 | |
| # The private commons clone (git@ URL from commons-configuration.json) | |
| # picks up this SSH -> HTTPS+token mapping. | |
| - name: Authenticate the commons clone | |
| run: git config --global url."https://x-access-token:${{ secrets.COMMONS_REPO_PAT }}@github.com/".insteadOf "git@github.com:" | |
| - name: Install stub for the unpublished MPL test-vectors artifact | |
| # The 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 (its tests skip). | |
| run: | | |
| set -euo pipefail | |
| tmp="$(mktemp -d)" | |
| echo placeholder > "$tmp/README.txt" | |
| "$JAVA_HOME/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: Run the orchestrated TestServer | |
| working-directory: test-server | |
| run: make test-server |