fix: add Git LFS support and llama.cpp build to CI workflows #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: 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 | |
| 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_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/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 |