+15
-1
.github/workflows/ci.yaml
+15
-1
.github/workflows/ci.yaml
···
40
40
include:
41
41
- os: ubuntu-latest
42
42
target: x86_64-unknown-linux-gnu
43
+
binary: x86-64
43
44
use-cross: false
44
45
run-integration-tests: true
45
46
- os: ubuntu-latest
46
47
target: x86_64-unknown-linux-musl
48
+
binary: x86-64
47
49
use-cross: true
48
50
run-integration-tests: true
49
51
- os: ubuntu-latest
50
52
target: aarch64-unknown-linux-gnu
53
+
binary: aarch64
51
54
use-cross: true
52
55
run-integration-tests: false # Cannot run aarch64 binaries on x86_64
53
56
- os: ubuntu-latest
54
57
target: aarch64-unknown-linux-musl
58
+
binary: aarch64
55
59
use-cross: true
56
60
run-integration-tests: false # Cannot run aarch64 binaries on x86_64
57
61
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
58
62
- os: macos-13 # intel
59
63
target: x86_64-apple-darwin
64
+
binary: x86_64
60
65
use-cross: false
61
66
run-integration-tests: true
62
67
- os: macos-latest # aarch64
63
68
toolchain: stable
64
69
target: aarch64-apple-darwin
70
+
binary: arm64
65
71
use-cross: false
66
72
run-integration-tests: true
67
73
- os: windows-latest
68
74
target: x86_64-pc-windows-msvc
75
+
binary: x86-64
69
76
use-cross: false
70
77
run-integration-tests: true
71
78
steps:
···
120
127
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
121
128
BINARY_PATH="${BINARY_PATH}.exe"
122
129
fi
123
-
./bin/verify-binary-architecture.sh "${{ matrix.target }}" "$BINARY_PATH"
130
+
131
+
if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then
132
+
echo "error: Architecture mismatch"
133
+
echo "Expected architecture: '${{ matrix.binary }}'"
134
+
echo "Found binary type: '$(file -b "$BINARY_PATH")'"
135
+
exit 1
136
+
fi
137
+
echo "ok: Architecture match"
124
138
if: ${{ matrix.run-integration-tests }}
125
139
126
140
- name: Run tests
+13
-1
.github/workflows/release-nightly.yaml
+13
-1
.github/workflows/release-nightly.yaml
···
62
62
include:
63
63
- os: ubuntu-latest
64
64
target: x86_64-unknown-linux-musl
65
+
binary: x86-64
65
66
use-cross: true
66
67
- os: ubuntu-latest
67
68
target: aarch64-unknown-linux-musl
69
+
binary: aarch64
68
70
use-cross: true
69
71
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
70
72
- os: macos-13
71
73
target: x86_64-apple-darwin
74
+
binary: x86_64
72
75
use-cross: false
73
76
- os: macos-latest
74
77
target: aarch64-apple-darwin
78
+
binary: arm64
75
79
use-cross: false
76
80
- os: windows-latest
77
81
target: x86_64-pc-windows-msvc
82
+
binary: x86-64
78
83
use-cross: false
79
84
steps:
80
85
- name: Checkout repository
···
110
115
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
111
116
BINARY_PATH="${BINARY_PATH}.exe"
112
117
fi
113
-
./bin/verify-binary-architecture.sh "${{ matrix.target }}" "$BINARY_PATH"
118
+
119
+
if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then
120
+
echo "error: Architecture mismatch"
121
+
echo "Expected architecture: '${{ matrix.binary }}'"
122
+
echo "Found binary type: '$(file -b "$BINARY_PATH")'"
123
+
exit 1
124
+
fi
125
+
echo "ok: Architecture match"
114
126
115
127
- name: Build archive
116
128
shell: bash
+13
-1
.github/workflows/release.yaml
+13
-1
.github/workflows/release.yaml
···
24
24
include:
25
25
- os: ubuntu-latest
26
26
target: x86_64-unknown-linux-musl
27
+
binary: x86-64
27
28
use-cross: true
28
29
- os: ubuntu-latest
29
30
target: aarch64-unknown-linux-musl
31
+
binary: aarch64
30
32
use-cross: true
31
33
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
32
34
- os: macos-13
33
35
target: x86_64-apple-darwin
36
+
binary: x86_64
34
37
use-cross: false
35
38
- os: macos-latest
36
39
target: aarch64-apple-darwin
40
+
binary: arm64
37
41
use-cross: false
38
42
- os: windows-latest
39
43
target: x86_64-pc-windows-msvc
44
+
binary: x86-64
40
45
use-cross: false
41
46
steps:
42
47
- name: Checkout repository
···
67
72
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
68
73
BINARY_PATH="${BINARY_PATH}.exe"
69
74
fi
70
-
./bin/verify-binary-architecture.sh "${{ matrix.target }}" "$BINARY_PATH"
75
+
76
+
if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then
77
+
echo "error: Architecture mismatch"
78
+
echo "Expected architecture: '${{ matrix.binary }}'"
79
+
echo "Found binary type: '$(file -b "$BINARY_PATH")'"
80
+
exit 1
81
+
fi
82
+
echo "ok: Architecture match"
71
83
72
84
- name: Build archive
73
85
shell: bash
-47
bin/verify-binary-architecture.sh
-47
bin/verify-binary-architecture.sh
···
1
-
#!/usr/bin/env bash
2
-
set -xeuo pipefail
3
-
4
-
if [ $# -ne 2 ]; then
5
-
echo "Usage: $0 <target-triple> <binary-path>"
6
-
exit 1
7
-
fi
8
-
TARGET_TRIPLE="$1"
9
-
BINARY_PATH="$2"
10
-
BINARY_FILE_TYPE=$(file -b "$BINARY_PATH")
11
-
12
-
# Architecture patterns
13
-
ARCHITECTURE_PATTERNS_FOR_AARCH64='aarch64|Aarch64|arm64'
14
-
ARCHITECTURE_PATTERNS_FOR_X86_64='x86-64|x86_64'
15
-
16
-
# Architecture helper functions
17
-
parse_architecture() {
18
-
grep -Eo \
19
-
-e "$ARCHITECTURE_PATTERNS_FOR_AARCH64" \
20
-
-e "$ARCHITECTURE_PATTERNS_FOR_X86_64" \
21
-
| head -n1
22
-
}
23
-
normalize_architecture() {
24
-
sed -E \
25
-
-e "s/($ARCHITECTURE_PATTERNS_FOR_AARCH64)/AArch64/" \
26
-
-e "s/($ARCHITECTURE_PATTERNS_FOR_X86_64)/x86-64/"
27
-
}
28
-
29
-
# Parse and normalize architectures
30
-
TARGET_ARCHITECTURE=$(
31
-
echo "$TARGET_TRIPLE" | parse_architecture | normalize_architecture \
32
-
|| echo "unknown (target)"
33
-
)
34
-
BINARY_ARCHITECTURE=$(
35
-
echo "$BINARY_FILE_TYPE" | parse_architecture | normalize_architecture \
36
-
|| echo "unknown (binary)"
37
-
)
38
-
39
-
# Verify that binary architecture matches target architecture
40
-
if [ "$BINARY_ARCHITECTURE" != "$TARGET_ARCHITECTURE" ]; then
41
-
echo "error: Architecture mismatch for '$TARGET_TRIPLE'"
42
-
echo "Expected architecture: '$TARGET_ARCHITECTURE'"
43
-
echo "Found architecture: '$BINARY_ARCHITECTURE'"
44
-
exit 1
45
-
fi
46
-
echo "ok: Architecture match for '$TARGET_TRIPLE'"
47
-
exit 0