Repository navigation
113 lines (99 loc) · 3.55 KB
/
Copy pathsetup-stackql-test.yml
File metadata and controls
113 lines (99 loc) · 3.55 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
name: 'setup stackql test'
on:
push:
branches:
- main
- 'develop-**'
pull_request:
defaults:
run:
shell: bash
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
- run: npm ci --ignore-scripts
- run: npm test
stackql-test-matrix:
name: Stackql on ${{ matrix.target.os }} (${{ matrix.target.arch }}) ${{ matrix.use_wrapper && 'with' || 'without' }} wrapper
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- { os: ubuntu-24.04, arch: X64 }
- { os: ubuntu-24.04-arm, arch: ARM64 }
- { os: windows-2025, arch: X64 }
- { os: windows-11-arm, arch: ARM64 }
- { os: macos-15-intel, arch: X64 }
- { os: macos-15, arch: ARM64 }
use_wrapper: [true, false]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Verify runner architecture
env:
EXPECTED_ARCH: ${{ matrix.target.arch }}
run: test "$RUNNER_ARCH" = "$EXPECTED_ARCH"
- name: Setup Stackql
uses: ./
with:
use_wrapper: ${{matrix.use_wrapper}}
- name: Verify native Windows binary architecture
if: runner.os == 'Windows'
shell: pwsh
run: |
$binary = if ($env:STACKQL_CLI_PATH) {
Join-Path $env:STACKQL_CLI_PATH 'stackql-bin.exe'
} else {
(Get-Command stackql.exe).Source
}
$bytes = [IO.File]::ReadAllBytes($binary)
$pe = [BitConverter]::ToInt32($bytes, 0x3c)
$machine = [BitConverter]::ToUInt16($bytes, $pe + 4)
$expected = if ($env:RUNNER_ARCH -eq 'ARM64') { 0xaa64 } else { 0x8664 }
if ($machine -ne $expected) { throw 'Installed binary does not match runner architecture' }
- name: Verify native Linux or macOS binary architecture
if: runner.os != 'Windows'
run: |
binary="$(command -v stackql)"
if [[ -n "${STACKQL_CLI_PATH:-}" ]]; then
binary="$STACKQL_CLI_PATH/stackql-bin"
fi
if [[ "$RUNNER_OS" == 'macOS' ]]; then
arch=x86_64
if [[ "$RUNNER_ARCH" == 'ARM64' ]]; then arch=arm64; fi
lipo "$binary" -verify_arch "$arch"
else
arch='x86-64'
if [[ "$RUNNER_ARCH" == 'ARM64' ]]; then arch='ARM aarch64'; fi
file "$binary" | grep -E "ELF 64-bit.*$arch"
fi
- name: Run Registry List
id: run-registry-list
run: |
echo "registry_list_output<<EOF" >> $GITHUB_ENV
stackql exec "REGISTRY LIST" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Validate Registry List
run: |
echo "Registry list output:"
echo "$registry_list_output"
# Validate header row: expect | provider | and | version | columns
# Use [[:space:]] instead of \s for macOS bash 3.2 compatibility
HEADER_REGEX='\|[[:space:]]*provider[[:space:]]*\|[[:space:]]*version[[:space:]]*\|'
if ! [[ "$registry_list_output" =~ $HEADER_REGEX ]]; then
echo "Registry list header does not match expected format"
exit 1
fi
# Validate at least one data row: | <name> | v<major>.<minor>.<patch> |
DATA_ROW_REGEX='\|[[:space:]]*[a-z][a-z0-9_]*[[:space:]]*\|[[:space:]]*v[0-9]+\.[0-9]+\.[0-9]+[[:space:]]*\|'
if ! [[ "$registry_list_output" =~ $DATA_ROW_REGEX ]]; then
echo "Registry list does not contain a valid data row"
exit 1
fi
echo "Registry list validated successfully."