-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (131 loc) · 5.1 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (131 loc) · 5.1 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
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
binary: fcg-linux-amd64
pkg: fcg-linux-amd64.tar.gz
lbug_asset: liblbug-linux-x86_64.tar.gz
lbug_lib_dir: lib/dynamic/linux-amd64
- os: ubuntu-24.04-arm
goos: linux
goarch: arm64
binary: fcg-linux-arm64
pkg: fcg-linux-arm64.tar.gz
lbug_asset: liblbug-linux-aarch64.tar.gz
lbug_lib_dir: lib/dynamic/linux-arm64
- os: macos-latest
goos: darwin
goarch: arm64
binary: fcg-darwin-arm64
pkg: fcg-darwin-arm64.tar.gz
lbug_asset: liblbug-osx-arm64.tar.gz
lbug_lib_dir: lib/dynamic/darwin
# - os: macos-13
# goos: darwin
# goarch: amd64
# binary: fcg-darwin-amd64
# pkg: fcg-darwin-amd64.tar.gz
# lbug_asset: liblbug-osx-x86_64.tar.gz
# lbug_lib_dir: lib/dynamic/darwin
- os: windows-latest
goos: windows
goarch: amd64
binary: fcg-windows-amd64.exe
pkg: fcg-windows-amd64.zip
lbug_asset: liblbug-windows-x86_64.zip
lbug_lib_dir: lib/dynamic/windows
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install MinGW (Windows)
if: matrix.goos == 'windows'
run: choco install mingw -y
- name: Download LadybugDB native library
shell: bash
run: |
LIB_DIR="${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}"
mkdir -p "$LIB_DIR"
ASSET_URL="https://github.com/LadybugDB/ladybug/releases/latest/download/${{ matrix.lbug_asset }}"
if [[ "${{ matrix.lbug_asset }}" == *.zip ]]; then
curl -fsSL "$ASSET_URL" -o /tmp/liblbug.zip
unzip -o /tmp/liblbug.zip -d "$LIB_DIR"
else
curl -fsSL "$ASSET_URL" | tar -xz -C "$LIB_DIR"
fi
# - name: Test
# run: go test ./... -count=1
# env:
# CGO_ENABLED: 1
- name: Build
run: go build -ldflags "-X github.com/kirovcaptain/FlashCodeGraph/internal/gateway/cli.version=${{ github.ref_name }}" -o ${{ matrix.binary }} ./cmd/fcg/
env:
CGO_ENABLED: 1
CGO_CFLAGS: "-I${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}"
CGO_LDFLAGS: "-L${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}"
- name: Package Linux release (binary + .so + patchelf rpath)
if: matrix.goos == 'linux'
run: |
sudo apt-get install -y patchelf
KUZU_DIR=$(go list -m -f '{{.Dir}}' github.com/kuzudb/go-kuzu)
LBUG_DIR="${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}"
mkdir -p _release
cp ${{ matrix.binary }} _release/
cp "$KUZU_DIR/${{ matrix.lbug_lib_dir }}/libkuzu.so" _release/
cp -a "$LBUG_DIR"/liblbug.so* _release/
patchelf --set-rpath '$ORIGIN' _release/${{ matrix.binary }}
tar -czf ${{ matrix.pkg }} -C _release .
- name: Package macOS release (binary + .dylib + rpath fix)
if: matrix.goos == 'darwin'
run: |
KUZU_DIR=$(go list -m -f '{{.Dir}}' github.com/kuzudb/go-kuzu)
LBUG_DIR="${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}"
mkdir -p _release
cp ${{ matrix.binary }} _release/
cp "$KUZU_DIR/${{ matrix.lbug_lib_dir }}/libkuzu.dylib" _release/
cp -a "$LBUG_DIR"/liblbug.dylib* _release/
install_name_tool -add_rpath @executable_path _release/${{ matrix.binary }}
for rpath in $(otool -l _release/${{ matrix.binary }} | awk '/LC_RPATH/{found=1} found && /path /{print $2; found=0}'); do
case "$rpath" in
/home/runner/*|/Users/runner/*) install_name_tool -delete_rpath "$rpath" _release/${{ matrix.binary }} 2>/dev/null || true ;;
esac
done
tar -czf ${{ matrix.pkg }} -C _release .
- name: Package Windows release (exe + DLLs)
if: matrix.goos == 'windows'
shell: bash
run: |
KUZU_DIR=$(go list -m -f '{{.Dir}}' github.com/kuzudb/go-kuzu)
mkdir -p _release
cp ${{ matrix.binary }} _release/
cp "$KUZU_DIR/lib/dynamic/windows/kuzu_shared.dll" _release/
cp "${{ github.workspace }}/.lbug/${{ matrix.lbug_lib_dir }}/lbug_shared.dll" _release/
cd _release && 7z a "../${{ matrix.pkg }}" . && cd ..
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pkg }}
path: ${{ matrix.pkg }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: artifacts/*