Repository navigation
137 lines (124 loc) · 4.32 KB
/
Copy pathnodejs-sdk-tests.yml
File metadata and controls
137 lines (124 loc) · 4.32 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
name: "Node.js SDK Tests"
env:
HUSKY: 0
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
validate:
name: "Node.js SDK Build and Validation"
if: github.event.repository.fork == false
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./nodejs
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
cache: "npm"
cache-dependency-path: "./nodejs/package-lock.json"
node-version: 22
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run prettier check
run: npm run format:check
- name: Run ESLint
run: npm run lint
- name: Typecheck SDK
run: npm run typecheck
- name: Build SDK
run: npm run build
- name: Build and verify release packages
run: |
npm run pack:release
npm run verify:release-packages
- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- name: Run test harness tests
working-directory: ./test/harness
run: npm test
test:
name: "Node.js SDK Tests (${{ matrix.os }}, ${{ matrix.transport }})"
if: github.event.repository.fork == false
env:
POWERSHELL_UPDATECHECK: Off
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
transport: ["default", "inprocess"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: ./nodejs
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
cache: "npm"
cache-dependency-path: "./nodejs/package-lock.json"
node-version: 22
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build SDK
run: npm run build
- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- name: Prepare Copilot CLI runtime
run: |
runtime_path=$(npm run --silent prepare:runtime -- --print-path)
echo "COPILOT_CLI_PATH=$runtime_path" >> "$GITHUB_ENV"
- name: Warm up PowerShell
if: runner.os == 'Windows'
run: pwsh.exe -Command "Write-Host 'PowerShell ready'"
- name: Select inprocess transport
if: matrix.transport == 'inprocess'
run: |
echo "COPILOT_SDK_DEFAULT_CONNECTION=inprocess" >> "$GITHUB_ENV"
- name: Run Node.js SDK tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
run: npm test
# JavaScript actions use a glibc-linked Node runtime, so Alpine runs through Docker.
test-musl-arm64:
name: "Node.js SDK Tests (Alpine ARM64, ${{ matrix.transport }})"
if: github.event.repository.fork == false
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
transport: ["default", "inprocess"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Alpine ARM64 tests (${{ matrix.transport }})
uses: ./.github/actions/run-alpine-tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
with:
image: node:22-alpine
workdir: /workspace/nodejs
transport: ${{ matrix.transport }}
command: |
npm ci --ignore-scripts
npm run build
(cd /workspace/test/harness && npm ci --ignore-scripts)
runtime_path="$(npm run --silent prepare:runtime -- --print-path)"
case "$runtime_path" in
*/prebuilds/linuxmusl-arm64/copilot-runtime) ;;
*)
echo "Expected the linuxmusl-arm64 runtime bundle, got: $runtime_path" >&2
exit 1
;;
esac
test -x "$runtime_path"
test -f "$(dirname "$runtime_path")/runtime.node"
export COPILOT_CLI_PATH="$runtime_path"
npm test