Skip to content

Commit

Permalink
feat: cicd arm64 (#339)
Browse files Browse the repository at this point in the history
Co-authored-by: Hien To <[email protected]>
  • Loading branch information
hiento09 and hientominh authored Dec 18, 2024
1 parent 6c85652 commit cf47200
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 5 deletions.
91 changes: 91 additions & 0 deletions .github/runners/actions-runner-ubuntu-2004-arm64.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Use NVIDIA CUDA 12.0.0 development image with Ubuntu 18.04 as the base
FROM ubuntu:20.04

# Docker and Docker Compose arguments

# Use 1001 and 121 for compatibility with GitHub-hosted runners
ARG RUNNER_UID=1000
ARG DOCKER_GID=1001

ENV DEBIAN_FRONTEND=noninteractive

# Install necessary packages
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
ca-certificates \
dnsutils \
ftp \
git \
uuid-dev \
iproute2 \
iputils-ping \
jq \
libunwind8 \
locales \
netcat \
openssh-client \
parallel \
python3-pip \
rsync \
shellcheck \
sudo \
telnet \
time \
tzdata \
unzip \
upx \
wget \
lsb-release \
openssl \
libssl-dev \
manpages-dev \
zip \
zstd \
pkg-config \
ccache \
gcc \
g++ \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& rm -rf /var/lib/apt/lists/*

# Add Kitware's APT repository for CMake
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \
apt-get update && \
apt-get install -y cmake

# Download latest git-lfs version
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get install -y --no-install-recommends git-lfs

ARG RUNNER_VERSION=2.321.0

RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \
&& groupadd docker --gid $DOCKER_GID \
&& usermod -aG sudo runner \
&& usermod -aG docker runner \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

ENV HOME=/home/runner

# cd into the user directory, download and unzip the github actions runner
RUN cd /home/runner && mkdir actions-runner && cd actions-runner \
&& curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-arm64-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./actions-runner-linux-arm64-${RUNNER_VERSION}.tar.gz

RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh

ADD ./start.sh /home/runner/start.sh

RUN chmod +x /home/runner/start.sh

ENTRYPOINT ["/bin/bash", "/home/runner/start.sh"]

USER runner
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_COMMON=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
ccache: true
ccache-dir: "/home/runner/.ccache"
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-20-04"
Expand Down Expand Up @@ -300,9 +308,10 @@ jobs:
git apply ../patches/0001-Add-API-query-buffer-size.patch
- name: use python for linux
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'

- name: Install tools on Windows
if: runner.os == 'Windows'
Expand All @@ -314,6 +323,11 @@ jobs:
run: |
sudo apt-get install -y ninja-build
python3 -m pip install awscli
if [ "${{ matrix.os }}${{ matrix.name }}" == "linuxarm64" ]; then
sudo apt-get install -y ccache
exit 0
fi
cd /tmp
wget https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-linux-x86_64.tar.xz
tar -xvf ccache-4.10.2-linux-x86_64.tar.xz
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ jobs:
strategy:
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_COMMON=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
ccache: true
ccache-dir: "/home/runner/.ccache"
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-20-04"
Expand Down Expand Up @@ -299,9 +307,10 @@ jobs:
git apply ../patches/0001-Add-API-query-buffer-size.patch
- name: use python for linux
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'

- name: Install tools on Windows
if: runner.os == 'Windows'
Expand All @@ -313,6 +322,10 @@ jobs:
run: |
sudo apt-get install -y ninja-build
python3 -m pip install awscli
if [ "${{ matrix.os }}${{ matrix.name }}" == "linuxarm64" ]; then
sudo apt-get install -y ccache
exit 0
fi
cd /tmp
wget https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-linux-x86_64.tar.xz
tar -xvf ccache-4.10.2-linux-x86_64.tar.xz
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/template-e2e-weekend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEXLLAMA_VERSION=${{github.event.pull_request.head.sha}} -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_COMMON=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
ccache: true
ccache-dir: "/home/runner/.ccache"
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-20-04"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/template-quality-gate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEXLLAMA_VERSION=${{github.event.pull_request.head.sha}} -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_COMMON=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
ccache: true
ccache-dir: "/home/runner/.ccache"
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-20-04"
Expand Down Expand Up @@ -266,9 +274,10 @@ jobs:
git apply ../patches/0001-Add-API-query-buffer-size.patch
- name: use python for linux
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.10"

- name: Install tools on Windows
if: runner.os == 'Windows'
Expand All @@ -280,6 +289,10 @@ jobs:
run: |
sudo apt-get install -y ninja-build
python3 -m pip install awscli
if [ "${{ matrix.os }}${{ matrix.name }}" == "linuxarm64" ]; then
sudo apt-get install -y ccache
exit 0
fi
cd /tmp
wget https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-linux-x86_64.tar.xz
tar -xvf ccache-4.10.2-linux-x86_64.tar.xz
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/template-quality-gate-submodule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEXLLAMA_VERSION=${{github.event.pull_request.head.sha}} -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_COMMON=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
ccache: true
ccache-dir: "/home/runner/.ccache"
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-20-04"
Expand Down Expand Up @@ -266,9 +274,10 @@ jobs:
git apply ../patches/0001-Add-API-query-buffer-size.patch
- name: use python for linux
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'

- name: Install tools on Windows
if: runner.os == 'Windows'
Expand All @@ -279,6 +288,10 @@ jobs:
run: |
sudo apt-get install -y ninja-build
python3 -m pip install awscli
if [ "${{ matrix.os }}${{ matrix.name }}" == "linuxarm64" ]; then
sudo apt-get install -y ccache
exit 0
fi
cd /tmp
wget https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-linux-x86_64.tar.xz
tar -xvf ccache-4.10.2-linux-x86_64.tar.xz
Expand Down Expand Up @@ -356,7 +369,7 @@ jobs:
make package
- name: Install Python
if: ${{matrix.run-e2e}}
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down

0 comments on commit cf47200

Please sign in to comment.