Repository navigation
131 lines (120 loc) · 4.31 KB
/
Copy pathgo-sdk-tests.yml
File metadata and controls
131 lines (120 loc) · 4.31 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
name: "Go SDK Tests"
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
validate:
name: "Go SDK Format and Lint"
if: github.event.repository.fork == false
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./go
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.24"
- name: Run go fmt
run: |
go fmt ./...
if [ -n "$(git status --porcelain)" ]; then
echo "❌ go fmt produced changes. Please run 'go fmt ./...' in go"
git --no-pager diff
exit 1
fi
echo "✅ go fmt produced no changes"
- name: Install golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
working-directory: ./go
version: latest
args: --timeout=5m
test:
name: "Go 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 }}
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./go
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-copilot
id: setup-copilot
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.24"
- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- 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"
echo "GOFLAGS=-tags=copilot_inprocess" >> "$GITHUB_ENV"
- name: Run Go SDK tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }}
run: /bin/bash test.sh
# JavaScript actions use a glibc-linked Node runtime, so Alpine runs through Docker.
test-musl-arm64:
name: "Go SDK Tests (Alpine ARM64, ${{ matrix.transport }})"
if: github.event.repository.fork == false
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
transport: ["default", "inprocess"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Go SDK tests on musl ARM64 (${{ matrix.transport }})
uses: ./.github/actions/run-alpine-tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
with:
image: golang:1.24-alpine
workdir: /workspace
transport: ${{ matrix.transport }}
command: |
apk add --no-cache build-base nodejs npm
npm --prefix nodejs ci --ignore-scripts
npm --prefix test/harness ci --ignore-scripts
runtime_path="$(npm --prefix nodejs 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"
if [ "$COPILOT_SDK_TEST_TRANSPORT" = "inprocess" ]; then
export GOFLAGS="-tags=copilot_inprocess"
else
unset GOFLAGS
fi
export CGO_ENABLED=1
test "$(go env GOARCH)" = "arm64"
test "$(go env CGO_ENABLED)" = "1"
cd go
/bin/bash test.sh