-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (95 loc) · 3.93 KB
/
Copy pathsmoke-test-linux.yml
File metadata and controls
111 lines (95 loc) · 3.93 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
name: Smoke Test (Linux)
on:
workflow_call:
permissions:
contents: read
env:
ARCHGATE_TELEMETRY: "0"
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/setup-bun-project
- name: Build Linux binary
run: bun build src/cli.ts --compile --bytecode --outfile dist/archgate-smoke-test
- name: Smoke test binary
run: |
chmod +x dist/archgate-smoke-test
output=$(dist/archgate-smoke-test --version 2>&1)
echo "archgate version: $output"
- name: Smoke test binary from ~/.archgate/bin/
run: |
mkdir -p ~/.archgate/bin
cp dist/archgate-smoke-test ~/.archgate/bin/archgate
chmod +x ~/.archgate/bin/archgate
output=$(~/.archgate/bin/archgate --version 2>&1)
echo "archgate version from binary install dir: $output"
rm -rf ~/.archgate/bin
- name: Smoke test binary from proto dir
run: |
mkdir -p ~/.proto/tools/archgate/0.0.0
cp dist/archgate-smoke-test ~/.proto/tools/archgate/0.0.0/archgate
chmod +x ~/.proto/tools/archgate/0.0.0/archgate
output=$(~/.proto/tools/archgate/0.0.0/archgate --version 2>&1)
echo "archgate version from proto dir: $output"
rm -rf ~/.proto/tools/archgate
- name: Smoke test binary from node_modules
run: |
project_dir=$(mktemp -d)
mkdir -p "$project_dir/node_modules/.bin"
echo '{}' > "$project_dir/package.json"
touch "$project_dir/bun.lock"
cp dist/archgate-smoke-test "$project_dir/node_modules/.bin/archgate"
chmod +x "$project_dir/node_modules/.bin/archgate"
output=$("$project_dir/node_modules/.bin/archgate" --version 2>&1)
echo "archgate version from node_modules: $output"
rm -rf "$project_dir"
- name: Smoke test install.sh
env:
ARCHGATE_VERSION: ${{ vars.LATEST_RELEASE_TAG || '' }}
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "$ARCHGATE_VERSION" ]; then
# Find the newest release that already has the Linux asset uploaded.
# On release-commit pushes the Validate and Release workflows start
# concurrently, so the latest tag may exist before its binaries are
# uploaded by release-binaries.yml — hitting a 404.
asset="archgate-linux-x64.tar.gz"
tags="$(gh release list --limit 5 --json tagName --jq '.[].tagName' 2>/dev/null || true)"
if [ -z "$tags" ]; then
echo "::warning::No releases found, skipping install.sh smoke test"
exit 0
fi
found=""
for tag in $tags; do
assets="$(gh release view "$tag" --json assets --jq '.assets[].name' 2>/dev/null || true)"
if echo "$assets" | grep -qF "$asset"; then
ARCHGATE_VERSION="$tag"
found=1
break
fi
done
if [ -z "$found" ]; then
echo "::warning::No release with $asset found, skipping install.sh smoke test"
exit 0
fi
export ARCHGATE_VERSION
fi
echo "Testing install.sh with version $ARCHGATE_VERSION"
ARCHGATE_INSTALL_DIR="$(mktemp -d)"
export ARCHGATE_INSTALL_DIR
sh install.sh
if [ ! -f "$ARCHGATE_INSTALL_DIR/archgate" ]; then
echo "::error::archgate binary not found at $ARCHGATE_INSTALL_DIR/archgate after install"
exit 1
fi
output="$("$ARCHGATE_INSTALL_DIR/archgate" --version 2>&1)"
echo "Installed archgate version: $output"
rm -rf "$ARCHGATE_INSTALL_DIR"