Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/self-hosted/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ -f /home/runner/actions-runner/.env ]; then
su -c /home/runner/actions-runner/run.sh - runner
else
/usr/bin/tail -f /dev/null
fi
18 changes: 18 additions & 0 deletions .github/self-hosted/linux-self-hosted.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04

RUN apt update && apt install -y sudo vim curl wget git build-essential cmake pkg-config libboost-all-dev libssl-dev
RUN useradd -m -s /bin/bash runner
RUN echo "runner ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER runner
WORKDIR /home/runner
COPY entrypoint.sh /home/runner/entrypoint.sh

RUN mkdir actions-runner
WORKDIR /home/runner/actions-runner
RUN curl -o actions-runner-linux.tar.gz -L https://github.com/actions/runner/releases/download/v2.322.0/actions-runner-linux-x64-2.322.0.tar.gz
RUN tar xzf ./actions-runner-linux.tar.gz && rm ./actions-runner-linux.tar.gz

USER root
WORKDIR /home/runner
ENTRYPOINT ["/home/runner/entrypoint.sh"]
51 changes: 51 additions & 0 deletions .github/workflows/cmake-self-hosted-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on Self Hosted Linux

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
build:
runs-on: self-hosted

steps:
- uses: actions/checkout@v4
with:
lfs: false

- name: Prepare container(onnxruntime)
shell: bash
run: |
./.github/actions/download-onnxruntime-linux.sh

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Debug --parallel 4

- name: Download assets(models)
shell: bash
run: |
./test/fixture/download-test-fixtures.sh

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --extra-verbose --build-config Debug
14 changes: 11 additions & 3 deletions test/fixture/download-test-fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

cd "$(dirname "$0")" || exit

curl -o sample/1/model.onnx "http://server.11math.com/static/onnxruntime-server/sample/model1.onnx"
curl -o sample/2/model.onnx "http://server.11math.com/static/onnxruntime-server/sample/model2.onnx"
cp sample/1/model.onnx sample/3.onnx
if [ ! -f sample/1/model.onnx ]; then
curl -o sample/1/model.onnx "http://server.11math.com/static/onnxruntime-server/sample/model1.onnx"
fi

if [ ! -f sample/2/model.onnx ]; then
curl -o sample/2/model.onnx "http://server.11math.com/static/onnxruntime-server/sample/model2.onnx"
fi

if [ ! -f sample/3.onnx ]; then
cp sample/1/model.onnx sample/3.onnx
fi