-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (122 loc) · 4.12 KB
/
release.yml
File metadata and controls
137 lines (122 loc) · 4.12 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
name: Release
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: jdx/mise-action@v3
- name: Build llama.cpp
run: |
git clone --depth 1 https://github.com/ggml-org/llama.cpp .deps/llama.cpp
cd .deps/llama.cpp
cmake -B build \
-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_SERVER=OFF -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j$(nproc) --target llama --target ggml --target common
- name: Tests
run: mise run test:ci
- name: Lint
run: mise run lint
build:
needs: validate
strategy:
matrix:
include:
- runner: ubuntu-latest
goos: linux
goarch: amd64
- runner: macos-latest
goos: darwin
goarch: arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch LFS objects
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git lfs install
git lfs fetch origin "${{ github.ref }}"
git lfs checkout
- uses: jdx/mise-action@v3
- name: Build llama.cpp
run: |
git clone --depth 1 https://github.com/ggml-org/llama.cpp .deps/llama.cpp
cd .deps/llama.cpp
CMAKE_ARGS="-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release"
if [ "${{ matrix.goos }}" = "darwin" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DLLAMA_METAL=ON"
fi
cmake -B build $CMAKE_ARGS
cmake --build build --config Release -j$(nproc || sysctl -n hw.ncpu) --target llama --target ggml --target common
- name: Build binary
env:
CGO_ENABLED: "1"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
go build -ldflags "-s -w -X github.com/rekal-dev/rekal-cli/cmd/rekal/cli.Version=${VERSION}" \
-o rekal ./cmd/rekal
- name: Create archive
run: |
ARCHIVE="rekal_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz"
tar czf "${ARCHIVE}" rekal LICENSE README.md
shasum -a 256 "${ARCHIVE}" > "${ARCHIVE}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rekal_${{ matrix.goos }}_${{ matrix.goarch }}
path: |
rekal_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz
rekal_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz.sha256
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Generate checksums
run: |
cd dist
cat *.sha256 > checksums.txt
rm -f *.sha256
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p' || echo "")
if [ -n "$PREV_TAG" ]; then
CHANGELOG=$(git log --oneline "${PREV_TAG}..HEAD" --no-merges \
--grep="^docs:" --grep="^test:" --grep="^chore:" --invert-grep)
else
CHANGELOG=$(git log --oneline HEAD --no-merges \
--grep="^docs:" --grep="^test:" --grep="^chore:" --invert-grep)
fi
# Write to file to avoid delimiter issues
echo "$CHANGELOG" > /tmp/changelog.txt
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" dist/* \
--title "${{ github.ref_name }}" \
--notes-file /tmp/changelog.txt