Skip to content

Commit

Permalink
macOS build
Browse files Browse the repository at this point in the history
To ensure things work on macOS.

Signed-off-by: Eric Curtin <[email protected]>
  • Loading branch information
ericcurtin committed Jul 27, 2024
1 parent 61cf698 commit 17e3b38
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 33 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: ci
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
on: [push, pull_request]
jobs:
build:
linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run a one-line script
run: ./ci.sh

macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Run a one-line script
shell: bash
run: ./ci.sh

16 changes: 12 additions & 4 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ main() {
maybe_sudo="sudo"
fi

local os
os="$(uname)"
if ! available autopep8; then
if available apt; then
if [ "$os" = "Linux" ]; then
if available apt; then
$maybe_sudo apt install -y python3-autopep8
else
else
$maybe_sudo dnf install -y python3-autopep8
fi
fi
fi

./container_build.sh
curl -fsSL https://raw.githubusercontent.com/containers/ramalama/main/install.sh | sudo bash
if [ "$os" = "Linux" ]; then
./container_build.sh
fi

cat install.sh | sudo sh

set +o pipefail
chmod +x ramalama
Expand All @@ -30,6 +37,7 @@ main() {

./ramalama pull tinyllama
autopep8 --exit-code ramalama # Check style is correct
shellcheck -- *.sh
# ramalama list | grep granite-code
# ramalama rm granite-code
}
Expand Down
39 changes: 17 additions & 22 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ amd_lshw() {
lshw -c display -numeric -disable network | grep -q 'vendor: .* \[1002\]'
}

gpu_check() {
if available lspci && lspci -d '10de:' | grep -q 'NVIDIA'; then
nvidia_available="true"
elif available lshw && nvidia_lshw; then
nvidia_available="true"
elif available nvidia-smi; then
nvidia_available="true"
fi
# gpu_check() {
# if available lspci && lspci -d '10de:' | grep -q 'NVIDIA'; then
# nvidia_available="true"
# elif available lshw && nvidia_lshw; then
# nvidia_available="true"
# elif available nvidia-smi; then
# nvidia_available="true"
# fi

if available lspci && lspci -d '1002:' | grep -q 'AMD'; then
amd_available="true"
elif available lshw && amd_lshw; then
amd_available="true"
fi
}
# if available lspci && lspci -d '1002:' | grep -q 'AMD'; then
# amd_available="true"
# elif available lshw && amd_lshw; then
# amd_available="true"
# fi
# }

download() {
local curl_cmd=("curl" "--globoff" "--location" "--proto-default" "https")
Expand All @@ -42,14 +42,9 @@ download() {
main() {
set -e -o pipefail

if [ "$(uname -s)" != "Linux" ]; then
echo "This script is intended to run on Linux only"
return 1
fi

if [ "$EUID" -ne 0 ]; then
echo "This script is intended to run as root only"
return 2
return 1
fi

local bindir
Expand All @@ -68,8 +63,8 @@ main() {
install -D -m755 "$from" "$bindir/"

if false; then # to be done
local nvidia_available="false"
local amd_available="false"
# local nvidia_available="false"
# local amd_available="false"
gpu_check
fi
}
Expand Down

0 comments on commit 17e3b38

Please sign in to comment.