1
0
mirror of https://github.com/containers/ramalama.git synced 2026-02-05 15:47:26 +01:00
Files
ramalama/test/ci.sh
Stephen Smoogen 8ab242f820 Move rpms (#1693)
* Start adding rpm/ramalama.spec for Fedora

Add a ramalama.spec to sit next to python-ramalama.spec while we get
this reviewed. Change various configs so they are aware of
ramalama.spec

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>

* Add needed obsoletes/provides in base rpm to start process.

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>

* Try to fix CI problems with initial mr

The initial MR puts two spec files in the same directory which was
causing problems with the CI. This splits them off into different
directories which should allow for the tooling to work.

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>

* Finish move of Fedora rpm package to new name.

Put changes into various files needed to allow for new RPM package
`ramalama` to build in Fedora infrastructure versus python3-ramalama.

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>

* Fix problem with path names lsm5 caught

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>

---------

Signed-off-by: Stephen Smoogen <ssmoogen@redhat.com>
Co-authored-by: Stephen Smoogen <ssmoogen@redhat.com>
2025-07-14 10:13:49 -04:00

91 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
available() {
command -v "$1" > /dev/null
}
mac_steps() {
./install.sh
}
linux_steps() {
shellcheck -- *.sh */*.sh */*/*.sh
if [ -n "$BRANCH" ]; then
$maybe_sudo BRANCH="$BRANCH" ./install.sh
return
fi
$maybe_sudo ./install.sh
}
get_version() {
grep "^version =.*" pyproject.toml | sed s/\"//g | grep -oE '[^ ]+$'
}
get_arg_llama_cpp() {
grep "ARG LLAMA_CPP_SHA=" container-images/ramalama/Containerfile
}
version_checks() {
local version
version=$(get_version)
grep "version.*$version" setup.py
grep "version.*$version" rpm/ramalama.spec
grep "version.*$version" ramalama/version.py
local arg_llama_cpp
arg_llama_cpp=$(get_arg_llama_cpp)
grep "$arg_llama_cpp" container-images/cuda/Containerfile
grep "$arg_llama_cpp" container-images/asahi/Containerfile
}
check_packaging() {
cd ramalama
for i in *.py; do
grep -q "$i" ../install.sh
done
cd -
}
main() {
set -ex -o pipefail
local maybe_sudo=""
if [ "$EUID" -ne 0 ]; then
maybe_sudo="sudo"
fi
check_packaging
version_checks
local os
os="$(uname -s)"
binfile=bin/ramalama
chmod +x "$binfile" install.sh
uname -a
/usr/bin/python3 --version
export BRANCH="main"
if false; then # This doesn't work for forked repos, will revisit
if [ -n "$GITHUB_HEAD_REF" ]; then
export BRANCH="$GITHUB_HEAD_REF"
elif [ -n "$GITHUB_REF_NAME" ]; then
export BRANCH="$GITHUB_REF_NAME"
fi
fi
if [ "$os" == "Darwin" ]; then
mac_steps
else
linux_steps
fi
$maybe_sudo rm -rf /usr/share/ramalama /opt/homebrew/share/ramalama /usr/local/share/ramalama
go install github.com/cpuguy83/go-md2man@latest
tmpdir=$(mktemp -d)
make install DESTDIR="$tmpdir" PREFIX=/usr
find "$tmpdir"
rm -rf "$tmpdir"
}
main