-
Notifications
You must be signed in to change notification settings - Fork 5
139 lines (114 loc) · 4.29 KB
/
Copy pathbuild.yml
File metadata and controls
139 lines (114 loc) · 4.29 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
components: clippy, rustfmt
- run: cargo fmt --check
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- run: cargo clippy --all-targets -- -D warnings
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- run: cargo test
npm-launcher:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- run: node --test 'npm/brave-search-cli/test/*.test.js'
audit:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions-rust-lang/audit@72c09e02f132669d52284a3323acdb503cfc1a24 # v1.2.7
with:
createIssues: false
build:
needs: [check, test]
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
include:
- target: linux-amd64
- target: linux-arm64
- target: darwin-amd64
- target: darwin-arm64
- target: windows-amd64
- target: windows-arm64
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Build ${{ matrix.target }}
run: make ${{ matrix.target }}
- name: Upload ${{ matrix.target }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bx-${{ matrix.target }}
path: dist/bx-*-${{ matrix.target }}*
if-no-files-found: error
# The darwin binaries are cross-compiled on Linux, so nothing in the build job
# can execute one. macos-15-intel is the last x86_64 image GitHub offers: when
# it retires in August 2027, darwin-amd64 loses its only execution check, and
# shipping it further means self-hosted Intel hardware or no verification.
# https://github.com/actions/runner-images/issues/13045
smoke-darwin:
needs: build
strategy:
fail-fast: false
matrix:
include:
- target: darwin-amd64
runner: macos-15-intel
- target: darwin-arm64
runner: macos-latest
runs-on: ${{ matrix.runner }}
env:
# The floor the README and install.sh promise. zig picks it implicitly, so
# a toolchain bump could raise it; assert it rather than trust it.
MACOS_MIN: 11.7.1
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: bx-${{ matrix.target }}
- name: Run ${{ matrix.target }} on ${{ matrix.runner }}
run: |
set -euo pipefail
bin=$(echo bx-*-${{ matrix.target }})
chmod +x "$bin" # artifacts are zipped, which drops the executable bit
# --version needs no API key and makes no network call.
version=$("./$bin" --version)
echo "$version"
expected="bx $(echo "$bin" | sed 's/^bx-//;s/-${{ matrix.target }}$//')"
[ "$version" = "$expected" ] ||
{ echo "::error::expected \"$expected\", got \"$version\""; exit 1; }
# Running here only proves it works on this runner's macOS, not that
# it still loads on the oldest one we claim to support.
minos=$(otool -l "$bin" | awk '/LC_BUILD_VERSION/{f=1} f&&/minos/{print $2; exit}')
echo "minos $minos"
[ "$minos" = "$MACOS_MIN" ] ||
{ echo "::error::minos is $minos, but the docs promise $MACOS_MIN"; exit 1; }