forked from promptfoo/promptfoo
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (81 loc) · 2.73 KB
/
nexe-build.yml
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
name: nexe build
run-name: |
${{ github.event_name == 'release' && 'Release ' || 'Manual ' }}
Nexe build for ${{ github.ref_name }}:
Promptfoo CLI executables by @${{ github.actor }}
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.arch == 'x64' && 'ubuntu-latest' || 'ubuntu-arm64' }}
timeout-minutes: 10
continue-on-error: true
strategy:
matrix:
arch: [x64, arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.arch }}
path: dist/
nexe-build:
needs: build
runs-on: ${{ matrix.os == 'macos' && (matrix.arch == 'arm64' && 'macos-latest' || 'macos-13') || (matrix.arch == 'x64' && 'ubuntu-latest' || 'ubuntu-arm64') }}
timeout-minutes: 300
continue-on-error: true
strategy:
matrix:
os: [linux, macos, win]
arch: [x64, arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.arch }}
path: dist/
- run: npm ci
- name: Cache nexe build artifacts
uses: actions/cache@v4
with:
path: ~/.nexe
key: ${{ matrix.arch }}-${{ runner.os }}-nexe-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.arch }}-${{ runner.os }}-nexe-
save-always: true
- name: Install nexe globally
run: npm install -g nexe
- name: Build executable
run: |
npx nexe --build \
-r drizzle/ \
-r package.json \
-r "dist/**/*" \
-r "node_modules/**/*" \
-i dist/src/main.js \
-o promptfoo-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'win' && '.exe' || '' }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: promptfoo-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'win' && '.exe' || '' }}
path: ./promptfoo-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'win' && '.exe' || '' }}
- name: Release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
with:
files: ./promptfoo-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'win' && '.exe' || '' }}
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}