-
-
Notifications
You must be signed in to change notification settings - Fork 132
120 lines (102 loc) · 3.99 KB
/
Copy pathe2e-binaries.yml
File metadata and controls
120 lines (102 loc) · 3.99 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
name: E2E Tests on Cross-Platform
on:
push:
branches: [main]
paths-ignore: &paths-ignore
- "**/*.md"
- "images/**"
- ".devcontainer/**"
- ".vscode/**"
- ".zed/**"
- "LICENSE"
- "cspell.json"
- ".cspellcache"
- ".secretlintrc.json"
pull_request:
branches: [main]
paths-ignore: *paths-ignore
permissions:
contents: read # Required for checking out code
jobs:
build:
name: Build binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup mise
uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v2
with:
experimental: true
- name: Setup Takumi Guard npm registry
uses: flatt-security/setup-takumi-guard-npm@9a5d797c2085b6326d3a2985c08e3a114b9b88c1 # v1
- name: Install dependencies
run: bun install
- name: Build binaries
run: |
mkdir -p dist-bun
bun build --compile --minify --sourcemap --target=bun-linux-x64 --outfile=dist-bun/rulesync-linux-x64 ./src/cli/index.ts
bun build --compile --minify --sourcemap --target=bun-linux-arm64 --outfile=dist-bun/rulesync-linux-arm64 ./src/cli/index.ts
bun build --compile --minify --sourcemap --target=bun-darwin-arm64 --outfile=dist-bun/rulesync-darwin-arm64 ./src/cli/index.ts
bun build --compile --minify --sourcemap --target=bun-darwin-x64 --outfile=dist-bun/rulesync-darwin-x64 ./src/cli/index.ts
bun build --compile --minify --sourcemap --target=bun-windows-x64 --outfile=dist-bun/rulesync-windows-x64.exe ./src/cli/index.ts
- name: Cache binaries
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: dist-bun
key: rulesync-binaries-${{ github.sha }}
enableCrossOsArchive: true
e2e:
name: E2E Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: build
strategy:
# Keep every platform leg running even if one fails, so a single
# platform-specific breakage does not mask the others' results.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Restore cached binaries
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: dist-bun
key: rulesync-binaries-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Make binary executable (Unix)
if: runner.os != 'Windows'
env:
MATRIX_OS: ${{ matrix.os }}
run: |
if [ "$MATRIX_OS" = "ubuntu-latest" ]; then
chmod +x dist-bun/rulesync-linux-x64
BINARY_PATH=dist-bun/rulesync-linux-x64
elif [ "$MATRIX_OS" = "macos-latest" ]; then
# macos-latest is Apple Silicon (arm64)
chmod +x dist-bun/rulesync-darwin-arm64
BINARY_PATH=dist-bun/rulesync-darwin-arm64
else
echo "Unexpected matrix OS for Unix binary selection: $MATRIX_OS" >&2
exit 1
fi
echo "BINARY_PATH=$BINARY_PATH" >> "$GITHUB_ENV"
- name: Set binary path (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
echo "BINARY_PATH=dist-bun/rulesync-windows-x64.exe" >> "$GITHUB_ENV"
- name: Setup mise
uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v2
with:
experimental: true
- name: Setup Takumi Guard npm registry
uses: flatt-security/setup-takumi-guard-npm@9a5d797c2085b6326d3a2985c08e3a114b9b88c1 # v1
- name: Install dependencies
run: pnpm install --ignore-scripts
- name: Test binary
env:
RULESYNC_CMD: ${{ env.BINARY_PATH }}
run: pnpm test:e2e