mirror of
https://github.com/containers/ramalama.git
synced 2026-02-05 06:46:39 +01:00
441 lines
12 KiB
YAML
441 lines
12 KiB
YAML
name: ci
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint Code
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv run -- make install-requirements
|
|
|
|
- name: Run format check
|
|
run: |
|
|
uv run -- make check-format
|
|
|
|
- name: Run lint
|
|
run: |
|
|
uv run -- make lint
|
|
|
|
- name: Run man check
|
|
run: |
|
|
uv run -- make man-check
|
|
|
|
- name: Run type checking
|
|
run: |
|
|
uv run -- make type-check
|
|
|
|
unit-test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options: {}
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
name: Unit Tests${{ matrix.variant.title }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
uv run -- make unit-tests
|
|
|
|
e2e-tests:
|
|
needs:
|
|
- lint
|
|
- unit-test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options:
|
|
activate-environment: true
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
activate-environment: true
|
|
name: E2E Tests${{ matrix.variant.title }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: install requirements
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
# /mnt has ~ 65 GB free disk space. / is too small.
|
|
sudo mkdir -m a=rwx -p /mnt/runner
|
|
sudo mkdir -m o=rwx -p /home/runner/.local
|
|
sudo chown runner:runner /mnt/runner /home/runner/.local
|
|
sudo mount --bind /mnt/runner /home/runner/.local
|
|
sudo apt-get update
|
|
sudo apt-get install podman bash codespell
|
|
uv tool install tox --with tox-uv
|
|
uv pip install ".[dev]"
|
|
|
|
- name: install ollama
|
|
shell: bash
|
|
run: ./.github/scripts/install-ollama.sh
|
|
|
|
- name: Upgrade to podman 5
|
|
run: |
|
|
set -e
|
|
# Enable universe repository which contains podman
|
|
sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu oracular universe"
|
|
# Update package lists
|
|
sudo apt-get update
|
|
sudo apt-get purge firefox
|
|
# Install specific podman version
|
|
sudo apt-get upgrade -y podman crun
|
|
|
|
- name: run e2e-tests
|
|
run: |
|
|
make e2e-tests
|
|
|
|
e2e-tests-nocontainer:
|
|
needs:
|
|
- lint
|
|
- unit-test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options:
|
|
activate-environment: true
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
activate-environment: true
|
|
name: E2E Tests (--no-container)${{ matrix.variant.title }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: install requirements
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
sudo apt-get update
|
|
sudo apt-get install podman bash codespell git cmake libcurl4-openssl-dev
|
|
sudo ./container-images/scripts/build_llama.sh
|
|
uv tool install tox --with tox-uv
|
|
uv pip install ".[dev]"
|
|
|
|
- name: install ollama
|
|
shell: bash
|
|
run: ./.github/scripts/install-ollama.sh
|
|
|
|
- name: Upgrade to podman 5
|
|
run: |
|
|
set -e
|
|
# Enable universe repository which contains podman
|
|
sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu oracular universe"
|
|
# Update package lists
|
|
sudo apt-get update
|
|
sudo apt-get purge firefox
|
|
# Install specific podman version
|
|
sudo apt-get upgrade -y podman crun
|
|
|
|
- name: run e2e-tests-nocontainer
|
|
run: |
|
|
make e2e-tests-nocontainer
|
|
|
|
e2e-tests-docker:
|
|
needs:
|
|
- lint
|
|
- unit-test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options:
|
|
activate-environment: true
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
activate-environment: true
|
|
name: E2E Tests (docker)${{ matrix.variant.title }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: install requirements
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install bash codespell
|
|
uv tool install tox --with tox-uv
|
|
uv pip install ".[dev]"
|
|
|
|
- name: install ollama
|
|
shell: bash
|
|
run: ./.github/scripts/install-ollama.sh
|
|
|
|
- name: Upgrade to podman 5
|
|
run: |
|
|
set -e
|
|
# Enable universe repository which contains podman
|
|
sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu oracular universe"
|
|
# Update package lists
|
|
sudo apt-get update
|
|
sudo apt-get purge firefox
|
|
# Install specific podman version
|
|
sudo apt-get upgrade -y podman crun
|
|
|
|
- name: Free Disk Space Linux
|
|
shell: bash
|
|
run: |
|
|
sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true
|
|
sudo rm -rf \
|
|
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
|
|
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
|
|
/usr/lib/jvm || true
|
|
|
|
# /mnt has ~ 65 GB free disk space. / is too small.
|
|
- name: Reconfigure Docker data-root
|
|
run: |
|
|
sudo mkdir -p /mnt/docker /etc/docker
|
|
echo '{"data-root": "/mnt/docker"}' > /tmp/daemon.json
|
|
sudo mv /tmp/daemon.json /etc/docker/daemon.json
|
|
cat /etc/docker/daemon.json
|
|
sudo systemctl restart docker.service
|
|
sudo mkdir -m a=rwx -p /mnt/tmp /mnt/runner
|
|
sudo mkdir -m o=rwx -p /home/runner/.local
|
|
sudo chown runner:runner /mnt/runner /home/runner/.local
|
|
sudo mount --bind /mnt/runner /home/runner/.local
|
|
df -h
|
|
|
|
- name: run e2e-tests-docker
|
|
run: |
|
|
docker info
|
|
make e2e-tests-docker
|
|
|
|
e2e-tests-macos:
|
|
needs:
|
|
- lint
|
|
- unit-test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options:
|
|
activate-environment: true
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
activate-environment: true
|
|
name: E2E Tests (MacOS)${{ matrix.variant.title }}
|
|
runs-on: macos-15
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: install requirements
|
|
shell: bash
|
|
run: |
|
|
brew install go bash jq llama.cpp shellcheck podman
|
|
uv tool install tox --with tox-uv
|
|
uv run -- make install-requirements
|
|
|
|
- name: install ollama
|
|
shell: bash
|
|
run: ./.github/scripts/install-ollama.sh
|
|
|
|
- name: run e2e-tests-nocontainer
|
|
shell: bash
|
|
run: |
|
|
make e2e-tests-nocontainer
|
|
|
|
e2e-tests-windows:
|
|
needs:
|
|
- lint
|
|
- unit-test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- title: ""
|
|
uv-options:
|
|
activate-environment: true
|
|
- title: " (python 3.10)"
|
|
uv-options:
|
|
python-version: '3.10'
|
|
activate-environment: true
|
|
name: E2E Tests (Windows)${{ matrix.variant.title }}
|
|
runs-on: windows-latest
|
|
timeout-minutes: 90
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Enable long path support
|
|
shell: pwsh
|
|
run: |
|
|
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with: ${{ matrix.variant.uv-options }}
|
|
|
|
- name: Update WSL2
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host "Updating WSL2..."
|
|
wsl --update
|
|
wsl --shutdown
|
|
|
|
- name: Install Podman
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host "Installing Podman on Windows..."
|
|
|
|
winget install --accept-source-agreements --silent --disable-interactivity --exact --id RedHat.Podman
|
|
|
|
# TODO: remove when this just works https://github.com/microsoft/winget-cli/issues/549
|
|
# Add Podman to PATH for current session
|
|
$podmanPath = "$env:ProgramFiles" + "\RedHat\Podman"
|
|
$env:PATH = "$podmanPath;$env:PATH"
|
|
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Process)
|
|
|
|
# Update PATH for future steps
|
|
Add-Content -Path $env:GITHUB_PATH -Value "$podmanPath"
|
|
|
|
Write-Host "Verifying Podman installation..."
|
|
podman --version
|
|
|
|
Write-Host "Initializing Podman machine..."
|
|
podman machine init --now --rootful
|
|
|
|
# Wait for Podman to be ready
|
|
$maxAttempts = 30
|
|
$attempt = 0
|
|
while ($attempt -lt $maxAttempts) {
|
|
try {
|
|
podman info | Out-Null
|
|
Write-Host "Podman is ready!"
|
|
break
|
|
}
|
|
catch {
|
|
$attempt++
|
|
Write-Host "Waiting for Podman to be ready (attempt $attempt/$maxAttempts)..."
|
|
Start-Sleep -Seconds 2
|
|
}
|
|
}
|
|
|
|
if ($attempt -eq $maxAttempts) {
|
|
Write-Error "Podman failed to start"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Podman info:"
|
|
podman info
|
|
|
|
- name: Install OpenSSL
|
|
shell: pwsh
|
|
run: |
|
|
winget install --accept-source-agreements --silent --disable-interactivity --exact --id ShiningLight.OpenSSL.Light
|
|
|
|
# Add OpenSSL to PATH for current session
|
|
$opensslPath = "$env:ProgramFiles" + "\OpenSSL-Win64\bin"
|
|
$env:PATH = "$opensslPath;$env:PATH"
|
|
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Process)
|
|
|
|
# Update PATH for future steps
|
|
Add-Content -Path $env:GITHUB_PATH -Value "$opensslPath"
|
|
|
|
openssl version
|
|
|
|
- name: Run E2E tests
|
|
shell: pwsh
|
|
env:
|
|
RAMALAMA_CONTAINER_ENGINE: podman
|
|
run: |
|
|
Write-Host "Running E2E tests..."
|
|
# Add uv tools to PATH
|
|
$uvToolsPath = "$env:USERPROFILE\.local\bin"
|
|
$env:PATH = "$uvToolsPath;$env:PATH"
|
|
|
|
# Run tests
|
|
uv run tox -e e2e -- -v
|
|
|
|
- name: Debug - Show Podman logs on failure
|
|
if: failure()
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host "=== Podman Machine List ==="
|
|
podman machine list
|
|
|
|
Write-Host "`n=== Podman System Connection List ==="
|
|
podman system connection list
|
|
|
|
Write-Host "`n=== Podman Info ==="
|
|
podman info || true
|
|
|
|
Write-Host "`n=== Podman Version ==="
|
|
podman version || true
|
|
|
|
Write-Host "`n=== Running Containers ==="
|
|
podman ps -a || true
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: windows-e2e-test-results
|
|
path: |
|
|
test-results/
|
|
*.log
|
|
retention-days: 7
|
|
|
|
# FIXME: ci script should be able to run on MAC.
|
|
# - name: Run ci
|
|
# shell: bash
|
|
# run: make ci
|