Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
65 lines (61 loc) · 2.25 KB
/
Copy pathaction.yml
File metadata and controls
65 lines (61 loc) · 2.25 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
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