Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/actions/run-alpine-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Run Alpine SDK Tests"
description: "Run an SDK test command in an ARM64 Alpine container."
inputs:
image:
description: "Container image used to run the tests."
required: true
workdir:
description: "Working directory inside the container."
required: true
transport:
description: "SDK transport to test: default or inprocess."
required: true
command:
description: "Language-specific setup and test command."
required: true
runs:
using: "composite"
steps:
- name: Run ${{ inputs.transport }} tests in Alpine
shell: bash
env:
ALPINE_TEST_COMMAND: ${{ inputs.command }}
ALPINE_TEST_IMAGE: ${{ inputs.image }}
ALPINE_TEST_TRANSPORT: ${{ inputs.transport }}
ALPINE_TEST_WORKDIR: ${{ inputs.workdir }}
run: |
script_path=$(mktemp "$RUNNER_TEMP/copilot-sdk-alpine-test.XXXXXX")
trap 'rm -f "$script_path"' EXIT
cat > "$script_path" <<'SCRIPT'
#!/bin/sh
set -eux

apk add --no-cache bash git
git config --global --add safe.directory "$GITHUB_WORKSPACE"

test "$(uname -m)" = "aarch64"
ldd --version 2>&1 | grep -qi musl

case "$COPILOT_SDK_TEST_TRANSPORT" in
inprocess) export COPILOT_SDK_DEFAULT_CONNECTION=inprocess ;;
default) unset COPILOT_SDK_DEFAULT_CONNECTION ;;
*) echo "Unknown transport: $COPILOT_SDK_TEST_TRANSPORT" >&2; exit 1 ;;
esac
SCRIPT
printf '%s\n' "$ALPINE_TEST_COMMAND" >> "$script_path"
chmod +x "$script_path"

docker run --rm \
--platform linux/arm64 \
--volume "$GITHUB_WORKSPACE:/workspace" \
--volume "$script_path:/tmp/copilot-sdk-alpine-test.sh:ro" \
--workdir "$ALPINE_TEST_WORKDIR" \
--env CI=true \
--env GITHUB_ACTIONS=true \
--env GITHUB_WORKSPACE=/workspace \
--env COPILOT_HMAC_KEY \
--env COPILOT_SDK_E2E_BACKEND \
--env BUNDLED_CLI_CACHE_DIR \
--env CARGO_TERM_COLOR \
--env RUST_BACKTRACE \
--env RUSTDOCFLAGS \
--env RUSTFLAGS \
--env COPILOT_SDK_TEST_TRANSPORT="$ALPINE_TEST_TRANSPORT" \
"$ALPINE_TEST_IMAGE" \
/bin/sh /tmp/copilot-sdk-alpine-test.sh
53 changes: 53 additions & 0 deletions .github/workflows/dotnet-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,56 @@ jobs:
path: dotnet/TestResults/
if-no-files-found: warn
retention-days: 7

# JavaScript actions use a glibc-linked Node runtime, so Alpine runs through Docker.
alpine-arm64:
name: ".NET SDK Tests (Alpine ARM64, ${{ matrix.transport }}, CAPI)"
if: github.event.repository.fork == false
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
env:
COPILOT_SDK_E2E_BACKEND: capi
strategy:
fail-fast: false
matrix:
transport: ["default", "inprocess"]
steps:
- uses: actions/checkout@v6.0.2

- name: Run ${{ matrix.transport }} tests on ARM64 Alpine
uses: ./.github/actions/run-alpine-tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
with:
image: mcr.microsoft.com/dotnet/sdk:10.0-alpine
workdir: /workspace
transport: ${{ matrix.transport }}
command: |
dotnet --info | grep -Eq "RID:[[:space:]]+linux-musl-arm64"

apk add --no-cache nodejs npm
(cd nodejs && npm ci --ignore-scripts)
(cd test/harness && npm ci --ignore-scripts)

export DOTNET_ROLL_FORWARD=Major
dotnet restore dotnet/test/GitHub.Copilot.SDK.Test.csproj

dotnet test dotnet/test/GitHub.Copilot.SDK.Test.csproj \
--no-restore \
--framework net8.0 \
-v n \
--blame-hang \
--blame-hang-timeout 10m \
--blame-hang-dump-type none \
--logger "trx;LogFilePrefix=test-results" \
--results-directory /workspace/dotnet/TestResults \
-p:RunAnalyzers=false

- name: Upload .NET test diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: dotnet-test-diagnostics-alpine-arm64-${{ matrix.transport }}-capi-${{ github.run_attempt }}
path: dotnet/TestResults/
if-no-files-found: warn
retention-days: 7
92 changes: 75 additions & 17 deletions .github/workflows/go-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,21 @@ permissions:
contents: read

jobs:
test:
name: "Go SDK Tests (${{ matrix.os }}, ${{ matrix.transport }})"
validate:
name: "Go SDK Format and Lint"
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 }}
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./go
steps:
- uses: actions/checkout@v6.0.2
- uses: ./.github/actions/setup-copilot
id: setup-copilot
- uses: actions/setup-go@v6
with:
go-version: "1.24"

- name: Run go fmt
if: runner.os == 'Linux'
working-directory: ./go
run: |
go fmt ./...
if [ -n "$(git status --porcelain)" ]; then
Expand All @@ -43,15 +31,37 @@ jobs:
exit 1
fi
echo "✅ go fmt produced no changes"

- name: Install golangci-lint
if: runner.os == 'Linux'
uses: golangci/golangci-lint-action@v9
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@v6.0.2
- uses: ./.github/actions/setup-copilot
id: setup-copilot
- uses: actions/setup-go@v6
with:
go-version: "1.24"

- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
Expand All @@ -71,3 +81,51 @@ jobs:
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@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
93 changes: 73 additions & 20 deletions .github/workflows/nodejs-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ permissions:
contents: read

jobs:
test:
name: "Node.js SDK Tests (${{ matrix.os }}, ${{ matrix.transport }})"
validate:
name: "Node.js SDK Build and Validation"
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 }}
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
Expand All @@ -35,35 +29,57 @@ jobs:
node-version: 22
- name: Install dependencies
run: npm ci --ignore-scripts

- name: Run prettier check
if: runner.os == 'Linux'
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
if: runner.os == 'Linux' && matrix.transport == 'default'
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
if: runner.os == 'Linux' && matrix.transport == 'default'
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@v6.0.2
- uses: actions/setup-node@v6
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)
Expand All @@ -82,3 +98,40 @@ jobs:
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@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
Loading
Loading