|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + # Build file modifications |
| 5 | + push: |
| 6 | + branches: [ 'master' ] |
| 7 | + paths: [ '.github/workflows/build-oneapi.yml', '.devops/**' ] |
| 8 | + #pull_request: |
| 9 | + # branches: [ 'master' ] |
| 10 | + |
| 11 | + # Weekly rebuild |
| 12 | + #schedule: |
| 13 | + # - cron: "0 4 * * 3" |
| 14 | + |
| 15 | + # Manual rebuild, in case of some important upstream change |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +jobs: |
| 19 | + server: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + ssl: [nossl] |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Checkout llama.cpp |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: ggerganov/llama.cpp |
| 34 | + path: repo |
| 35 | + |
| 36 | + - name: Get number of CPU cores |
| 37 | + uses: SimenB/github-actions-cpu-cores@v2 |
| 38 | + id: cpu-cores |
| 39 | + |
| 40 | + - name: Setup Intel oneAPI compiler |
| 41 | + run: | |
| 42 | + apt-get update |
| 43 | + apt-get install -y wget gpg |
| 44 | + wget -q -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor --output /etc/apt/trusted.gpg.d/oneapi.gpg |
| 45 | + echo 'deb [trusted=yes] https://apt.repos.intel.com/oneapi all main' >/etc/apt/sources.list.d/oneapi.list |
| 46 | + apt-get update |
| 47 | + apt-get install -y intel-oneapi-compiler-dpcpp-cpp cmake git ccache |
| 48 | +
|
| 49 | + - name: CMake |
| 50 | + run: | |
| 51 | + . /opt/intel/oneapi/setvars.sh |
| 52 | + mkdir repo/build |
| 53 | + cd repo/build |
| 54 | + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_C_FLAGS="-Ofast -xCORE-AVX2" -DCMAKE_CXX_FLAGS="-Ofast -xCORE-AVX2" -DLLAMA_NATIVE=OFF -DLLAMA_STATIC=ON -DLLAMA_BUILD_SERVER=ON |
| 55 | + cmake --build . --config Release --target server -j ${{ steps.cpu-cores.outputs.count }} |
| 56 | + strip bin/server |
| 57 | +
|
| 58 | + - name: Upload build artifact |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: server-${{ matrix.ssl }}-oneapi |
| 62 | + path: repo/build/bin/server |
| 63 | + if-no-files-found: error |
| 64 | + |
| 65 | + - name: Build and push Docker image |
| 66 | + uses: macbre/push-to-ghcr@v13 |
| 67 | + with: |
| 68 | + dockerfile: .devops/server.Dockerfile |
| 69 | + context: repo/build/bin |
| 70 | + image_name: ${{ github.repository }} |
| 71 | + image_tag: server-${{ matrix.ssl }}-oneapi |
| 72 | + github_token: ${{ secrets.GHCR_ACCESS_TOKEN }} |
| 73 | + docker_io_user: ${{ vars.DOCKER_IO_USER }} |
| 74 | + docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} |
| 75 | + |
0 commit comments