chore: init

This commit is contained in:
2026-04-24 09:10:36 +03:00
commit 3b1c6843d6
13 changed files with 562 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
name: build-release
on:
workflow_dispatch:
inputs:
tag:
description: "mistral.rs upstream tag"
required: true
type: string
jobs:
plan:
runs-on: fedora
outputs:
flavours: ${{ steps.plan.outputs.flavours }}
version: ${{ steps.plan.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: plan
run: |
version="${TAG#v}"
echo "version=${version}" >> "$GITHUB_OUTPUT"
# Emit flavours as a JSON array for matrix consumption
flavours=$(yq -o=json -I=0 '.flavours' flavours.yml)
echo "flavours=${flavours}" >> "$GITHUB_OUTPUT"
env:
TAG: ${{ inputs.tag }}
build:
needs: plan
runs-on: cuda-13.0
strategy:
fail-fast: false
matrix:
flavour: ${{ fromJSON(needs.plan.outputs.flavours) }}
steps:
- uses: actions/checkout@v4
- name: Clone mistral.rs at tag
run: |
git clone --depth 1 --branch "${{ inputs.tag }}" \
https://github.com/EricLBuehler/mistral.rs.git src/
- name: Build
run: ./script/build-binary.sh
env:
FLAVOUR_NAME: ${{ matrix.flavour.name }}
CUDA_HOME: ${{ matrix.flavour.cuda_home }}
CARGO_FEATURES: ${{ matrix.flavour.cargo_features }}
CUDA_COMPUTE_CAP: ${{ matrix.flavour.compute_caps }}
SRC_DIR: src
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: mistralrs-server-${{ matrix.flavour.name }}
path: artifacts/mistralrs-server-${{ matrix.flavour.name }}
retention-days: 1
package:
needs: [plan, build]
runs-on: fedora
strategy:
fail-fast: false
matrix:
flavour: ${{ fromJSON(needs.plan.outputs.flavours) }}
steps:
- uses: actions/checkout@v4
#- name: Install build tools
# run: sudo dnf install -y rpm-build rpmdevtools systemd-rpm-macros
- name: Download binary
uses: actions/download-artifact@v3
with:
name: mistralrs-server-${{ matrix.flavour.name }}
path: artifacts/
- name: Build RPM
run: |
rpmdev-setuptree
cp artifacts/mistralrs-server-${{ matrix.flavour.name }} ~/rpmbuild/SOURCES/
cp rpm/systemd/mistralrs@.service ~/rpmbuild/SOURCES/
cp rpm/systemd/mistralrs@.conf.example ~/rpmbuild/SOURCES/
rpmbuild -bb rpm/mistralrs.spec \
--define "mistralrs_version ${{ needs.plan.outputs.version }}" \
--define "mistralrs_flavour ${{ matrix.flavour.name }}"
- name: Upload RPM
uses: actions/upload-artifact@v3
with:
name: rpm-${{ matrix.flavour.name }}
path: ~/rpmbuild/RPMS/x86_64/*.rpm
retention-days: 7
publish:
needs: [plan, package]
runs-on: fedora
# concurrency ensures only one publish runs at a time — repo metadata
# corruption is a nightmare if two createrepo_c processes race.
concurrency:
group: rpm-publish
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
#- name: Install tools
# run: sudo dnf install -y createrepo_c rpm-sign rsync
- name: Download all RPMs
uses: actions/download-artifact@v3
with:
path: rpms/
pattern: rpm-*
merge-multiple: true
- name: Import signing key
run: |
echo "${{ secrets.RPM_SIGNING_KEY }}" | gpg --batch --import
echo "%_gpg_name ${{ secrets.RPM_SIGNING_KEY_ID }}" > ~/.rpmmacros
- name: Sign and publish
run: ./script/publish-repo.sh rpms/
env:
RSYNC_TARGET: ${{ secrets.RSYNC_TARGET }}
RSYNC_SSH_KEY: ${{ secrets.RSYNC_SSH_KEY }}

View File

@@ -0,0 +1,43 @@
name: poll-upstream
on:
schedule:
- cron: "*/15 * * * *"
workflow_dispatch: {}
jobs:
check:
runs-on: fedora
steps:
- name: Get upstream latest tag
id: upstream
run: |
tag=$(curl -sSfL \
-H 'Accept: application/vnd.github+json' \
https://api.github.com/repos/EricLBuehler/mistral.rs/releases/latest \
| jq -r .tag_name)
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "Upstream latest: ${tag}"
- name: Get published version from our repo
id: published
run: |
# Query our own dnf repo. If the version is there, we've already built it.
# Strip leading 'v' because RPM versions don't use it.
version="${UPSTREAM_TAG#v}"
if curl -sSfI "https://rpm.lair.cafe/mistralrs/fedora-43/x86_64/mistralrs-server-cuda13-fa-${version}-1.fc43.x86_64.rpm" | grep -q '^HTTP.*200'; then
echo "already_built=true" >> "$GITHUB_OUTPUT"
else
echo "already_built=false" >> "$GITHUB_OUTPUT"
fi
env:
UPSTREAM_TAG: ${{ steps.upstream.outputs.tag }}
- name: Trigger build workflow
if: steps.published.outputs.already_built == 'false'
run: |
curl -sSfL -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H 'Accept: application/json' \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/workflows/build-release.yml/dispatches" \
-d "{\"ref\":\"main\",\"inputs\":{\"tag\":\"${{ steps.upstream.outputs.tag }}\"}}"