The rpm-changelog action's repo-url input uses mktemp which fails on runners with restricted /tmp permissions. Clone the upstream repo directly in the workflow and use source-dir instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
207 lines
6.8 KiB
YAML
207 lines
6.8 KiB
YAML
name: build-release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "mistral.rs upstream tag"
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: poll-and-build
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: cuda13
|
|
fedora_version: "43"
|
|
runner: cuda-13.0
|
|
cuda_home: /usr/local/cuda-13.0
|
|
cargo_features: "cuda cudnn flash-attn nccl"
|
|
compute_caps: "120"
|
|
build_jobs: 12
|
|
nvcc_threads: 4
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install/update Rust toolchain
|
|
run: |
|
|
if command -v rustup &> /dev/null; then
|
|
rustup update stable
|
|
else
|
|
curl --proto '=https' --tlsv1.2 --silent --show-error --fail https://sh.rustup.rs | sh -s -- -y
|
|
fi
|
|
echo "${HOME}/.cargo/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Clone mistral.rs at tag
|
|
run: |
|
|
git clone --depth 1 --branch "${{ inputs.tag }}" \
|
|
https://github.com/EricLBuehler/mistral.rs.git src/
|
|
|
|
- name: Build mistralrs
|
|
run: |
|
|
export PATH="${{ matrix.cuda_home }}/bin:${PATH}"
|
|
export LD_LIBRARY_PATH="${{ matrix.cuda_home }}/targets/x86_64-linux/lib:${{ matrix.cuda_home }}/lib64:${LD_LIBRARY_PATH:-}"
|
|
export LIBRARY_PATH="${{ matrix.cuda_home }}/targets/x86_64-linux/lib:${{ matrix.cuda_home }}/lib64:${LIBRARY_PATH:-}"
|
|
cd src
|
|
cargo build --release --locked --features "${{ matrix.cargo_features }}"
|
|
env:
|
|
CUDA_COMPUTE_CAP: ${{ matrix.compute_caps }}
|
|
CARGO_BUILD_JOBS: ${{ matrix.build_jobs }}
|
|
NVCC_THREADS: ${{ matrix.nvcc_threads }}
|
|
|
|
- name: Collect artifacts
|
|
run: |
|
|
mkdir --parents artifacts
|
|
cp src/target/release/mistralrs "artifacts/mistralrs-${{ matrix.name }}"
|
|
echo "built: $(artifacts/mistralrs-${{ matrix.name }} --version 2>&1 | head -1)"
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: mistralrs-${{ matrix.name }}-fc${{ matrix.fedora_version }}
|
|
path: artifacts/mistralrs-${{ matrix.name }}
|
|
retention-days: 1
|
|
|
|
package:
|
|
needs: build
|
|
runs-on: fedora-43
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: cuda13
|
|
fedora_version: "43"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: mistralrs-${{ matrix.name }}-fc${{ matrix.fedora_version }}
|
|
path: artifacts/
|
|
|
|
- name: Determine version
|
|
id: version
|
|
run: |
|
|
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
|
|
- name: Clone upstream for changelog
|
|
run: |
|
|
git clone --depth 50 --branch "${{ inputs.tag }}" \
|
|
https://github.com/EricLBuehler/mistral.rs.git upstream/
|
|
|
|
- name: Generate changelog
|
|
uses: https://git.lair.cafe/actions/rpm-changelog@v1
|
|
with:
|
|
spec: rpm/mistralrs.spec
|
|
version: ${{ steps.version.outputs.version }}
|
|
source-dir: upstream/
|
|
|
|
- name: Build RPM
|
|
run: |
|
|
rm -f ~/.rpmmacros
|
|
rpmdev-setuptree
|
|
cp artifacts/mistralrs-${{ matrix.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 ${{ steps.version.outputs.version }}" \
|
|
--define "mistralrs_flavour ${{ matrix.name }}" \
|
|
--undefine dist \
|
|
--define "dist .fc${{ matrix.fedora_version }}"
|
|
|
|
- name: Upload RPM
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: rpm-${{ matrix.name }}-fc${{ matrix.fedora_version }}
|
|
path: ~/rpmbuild/RPMS/x86_64/*.rpm
|
|
retention-days: 7
|
|
|
|
publish:
|
|
needs: package
|
|
runs-on: fedora-43
|
|
env:
|
|
RPM_REPO_HOST: oolon.kosherinata.internal
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- fedora_version: "43"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download RPMs for fc${{ matrix.fedora_version }}
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: rpms/
|
|
pattern: rpm-*-fc${{ matrix.fedora_version }}
|
|
|
|
- name: Flatten RPM artifacts
|
|
run: |
|
|
find rpms/ -name '*.rpm' -exec mv --target-directory=rpms/ {} +
|
|
find rpms/ -mindepth 1 -type d -empty -delete
|
|
|
|
- name: Check for sequoia-sq
|
|
run: |
|
|
if ! command -v sq &> /dev/null; then
|
|
echo "ERROR: sequoia-sq is not installed. Install with: sudo dnf install sequoia-sq"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Import signing key
|
|
run: |
|
|
echo "${{ secrets.RPM_SIGNING_KEY }}" | gpg --batch --import
|
|
fpr=$(gpg --batch --with-colons --list-keys "${{ secrets.RPM_SIGNING_KEY_ID }}" | awk -F: '/^fpr:/ { print $10; exit }')
|
|
echo "${fpr}:6:" | gpg --batch --import-ownertrust
|
|
sed "s/@GPG_NAME@/${{ secrets.RPM_SIGNING_KEY_ID }}/" rpm/rpmmacros > ~/.rpmmacros
|
|
|
|
- name: Sign RPMs
|
|
run: |
|
|
for rpm in rpms/*.rpm; do
|
|
echo "signing ${rpm}..."
|
|
rpm --addsign "${rpm}"
|
|
done
|
|
|
|
- name: Set up SSH
|
|
run: |
|
|
install --directory --mode 700 ~/.ssh
|
|
echo "${RSYNC_SSH_KEY}" | install --mode 600 /dev/stdin ~/.ssh/id_ed25519
|
|
env:
|
|
RSYNC_SSH_KEY: ${{ secrets.RSYNC_SSH_KEY }}
|
|
|
|
- name: Test SSH connectivity
|
|
run: |
|
|
ssh -o StrictHostKeyChecking=accept-new "gitea_ci@${RPM_REPO_HOST}" exit
|
|
|
|
- name: Sync RPMs to repo
|
|
run: |
|
|
rsync \
|
|
--archive \
|
|
--verbose \
|
|
--chmod D755,F644 \
|
|
rpms/*.rpm \
|
|
"gitea_ci@${RPM_REPO_HOST}:/var/www/rpm/fedora/${{ matrix.fedora_version }}/x86_64/"
|
|
|
|
- name: Update repo metadata
|
|
run: |
|
|
ssh "gitea_ci@${RPM_REPO_HOST}" \
|
|
"cd /var/www/rpm/fedora/${{ matrix.fedora_version }}/x86_64 && createrepo_c --update ."
|
|
|
|
- name: Generate packages.json
|
|
run: |
|
|
scp script/generate-packages-json.py "gitea_ci@${RPM_REPO_HOST}:/tmp/"
|
|
ssh "gitea_ci@${RPM_REPO_HOST}" \
|
|
"python3 /tmp/generate-packages-json.py \
|
|
--repodata-dir /var/www/rpm/fedora/${{ matrix.fedora_version }}/x86_64/repodata \
|
|
--output /var/www/rpm/fedora/${{ matrix.fedora_version }}/x86_64/packages.json \
|
|
--base-url https://rpm.lair.cafe/fedora/${{ matrix.fedora_version }}/x86_64"
|