mirror of
https://github.com/containers/ramalama.git
synced 2026-02-05 06:46:39 +01:00
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -10,9 +10,11 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install bats bash codespell python3-argcomplete
|
||||
pipx install omlmd black flake8
|
||||
make install-requirements
|
||||
- name: run test
|
||||
run: make test
|
||||
run: |
|
||||
make validate
|
||||
make bats
|
||||
|
||||
macos:
|
||||
runs-on: macos-14
|
||||
@@ -20,8 +22,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: install golang
|
||||
shell: bash
|
||||
run: brew install go
|
||||
run: make install-requirements
|
||||
run: |
|
||||
brew install go
|
||||
make install-requirements
|
||||
- name: Run a one-line script
|
||||
shell: bash
|
||||
run: make validate
|
||||
@@ -29,4 +32,3 @@ jobs:
|
||||
# - name: Run ci
|
||||
# shell: bash
|
||||
# run: make ci
|
||||
|
||||
|
||||
10
Makefile
10
Makefile
@@ -35,10 +35,7 @@ help:
|
||||
|
||||
.PHONY:
|
||||
install-requirements:
|
||||
@pipx install -q black flake8
|
||||
$(PYTHON) -m pip install --user -r requirements.txt
|
||||
pip install "huggingface_hub[cli]==0.25.1"
|
||||
pip install "omlmd==0.1.5"
|
||||
pipx install -q black flake8 argcomplete wheel omlmd huggingface_hub[cli] codespell
|
||||
|
||||
.PHONY:
|
||||
install-completions:
|
||||
@@ -113,6 +110,9 @@ pypi: clean docs
|
||||
.PHONY: bats
|
||||
bats:
|
||||
RAMALAMA=$(CURDIR)/bin/ramalama bats -T test/system/
|
||||
|
||||
.PHONY: bats-nocontainer
|
||||
bats-nocontainer:
|
||||
_RAMALAMA_TEST_OPTS=--nocontainer RAMALAMA=$(CURDIR)/bin/ramalama bats -T test/system/
|
||||
|
||||
.PHONY: ci
|
||||
@@ -120,7 +120,7 @@ ci:
|
||||
test/ci.sh
|
||||
|
||||
.PHONY: test
|
||||
test: validate bats ci codespell
|
||||
test: validate bats bats-nocontainer ci
|
||||
make clean
|
||||
hack/tree_status.sh
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ def main(args):
|
||||
if args.version:
|
||||
return ramalama.print_version(args)
|
||||
|
||||
if ramalama.run_container(args):
|
||||
return
|
||||
|
||||
# Process CLI
|
||||
try:
|
||||
if ramalama.run_container(args):
|
||||
return
|
||||
|
||||
args.func(args)
|
||||
except ramalama.HelpException:
|
||||
parser.print_help()
|
||||
|
||||
@@ -46,6 +46,9 @@ Valid placeholders for the Go template are listed below:
|
||||
#### **--help**, **-h**
|
||||
Print usage message
|
||||
|
||||
#### **--no-trunc**
|
||||
Display the extended information
|
||||
|
||||
#### **--noheading**, **-n**
|
||||
Do not print heading
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ def containers_parser(subparsers):
|
||||
parser = subparsers.add_parser("containers", aliases=["ps"], help="list all RamaLama containers")
|
||||
parser.add_argument("--format", help="pretty-print containers to JSON or using a Go template")
|
||||
parser.add_argument("-n", "--noheading", dest="noheading", action="store_true", help="do not display heading")
|
||||
parser.add_argument("--no-trunc", dest="notrunc", action="store_true", help="display the extended information")
|
||||
parser.add_argument("--container", default=False, action="store_false", help=argparse.SUPPRESS)
|
||||
parser.set_defaults(func=list_containers)
|
||||
|
||||
@@ -206,6 +207,8 @@ def _list_containers(args):
|
||||
conman_args = [conman, "ps", "-a", "--filter", "label=RAMALAMA container"]
|
||||
if args.noheading:
|
||||
conman_args += ["--noheading"]
|
||||
if hasattr(args, "notrunc") and args.notrunc:
|
||||
conman_args += ["--no-trunc"]
|
||||
|
||||
if args.format:
|
||||
conman_args += [f"--format={args.format}"]
|
||||
|
||||
@@ -133,7 +133,7 @@ function check_help() {
|
||||
# Test for regression of #7273 (spurious "--remote" help on output)
|
||||
for helpopt in help --help -h; do
|
||||
run_ramalama $helpopt
|
||||
is "${lines[0]}" "usage: ramalama [-h] [--store STORE] [--dryrun] [--nocontainer]" \
|
||||
is "${lines[0]}" "usage: ramalama [-h] [--store STORE] [--dryrun] [--container] [--nocontainer]" \
|
||||
"ramalama $helpopt: first line of output"
|
||||
done
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ verify_begin="podman run --rm -i --label \"RAMALAMA container\" --security-opt=l
|
||||
}
|
||||
|
||||
@test "ramalama serve and stop" {
|
||||
skip "Seems to cause race conditions"
|
||||
skip_if_nocontainer
|
||||
|
||||
model=ollama://tiny-llm:latest
|
||||
@@ -61,14 +62,15 @@ verify_begin="podman run --rm -i --label \"RAMALAMA container\" --security-opt=l
|
||||
cid="$output"
|
||||
run_ramalama containers -n
|
||||
is "$output" ".*${cid:0:10}" "list correct with cid"
|
||||
run_ramalama ps --noheading
|
||||
run_ramalama ps --noheading --no-trunc
|
||||
is "$output" ".*${container2}" "list correct with cid and no heading"
|
||||
run_ramalama stop ${cid}
|
||||
run_ramalama ps --noheading
|
||||
is "$output" "" "all containers gone"
|
||||
}
|
||||
|
||||
@test "ramalama --detach serve and stop all" {
|
||||
@test "ramalama --detach serve multiple" {
|
||||
skip "Seems to cause race conditions"
|
||||
skip_if_nocontainer
|
||||
|
||||
model=ollama://tiny-llm:latest
|
||||
@@ -84,9 +86,6 @@ verify_begin="podman run --rm -i --label \"RAMALAMA container\" --security-opt=l
|
||||
run_ramalama serve -p ${port2} --detach ${model}
|
||||
cid="$output"
|
||||
|
||||
run -0 podman inspect $cid
|
||||
echo $output
|
||||
|
||||
run_ramalama containers --noheading
|
||||
is ${#lines[@]} 2 "two containers should be running"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user