From 1e85a140a358a71fbafb669dc2bc20a6589ae63b Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 27 Mar 2024 12:44:40 -0700 Subject: [PATCH 1/3] only generate on changes to llm subdirectory --- .github/workflows/test.yaml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 31710aa1..56a02572 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,11 +23,14 @@ jobs: } { - echo GENERATE_CUDA=$(changed llm) - echo GENERATE_ROCM=$(changed llm) + echo GENERATE=$(changed llm/) + echo GENERATE_CUDA=$(changed llm/) + echo GENERATE_ROCM=$(changed llm/) } >>$GITHUB_OUTPUT generate: + needs: [changes] + if: ${{ needs.changes.outputs.GENERATE == 'True' }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-2019] @@ -164,7 +167,6 @@ jobs: if: ${{ startsWith(matrix.os, 'windows-') }} - uses: golangci/golangci-lint-action@v3 test: - needs: generate strategy: matrix: os: [ubuntu-latest, macos-latest, windows-2019] @@ -187,10 +189,19 @@ jobs: go-version: '1.22' cache: true - run: go get - - uses: actions/download-artifact@v4 - with: - name: ${{ matrix.os }}-${{ matrix.arch }}-libraries - path: llm/llama.cpp/build + - run: | + mkdir -p llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/ + touch llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/stub.so + if: ${{ startsWith(matrix.os, 'ubuntu-') }} + - run: | + mkdir -p llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/ + touch llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/stub.dylib + touch llm/llama.cpp/ggml-metal.metal + if: ${{ startsWith(matrix.os, 'macos-') }} + - run: | + mkdir -p llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/ + touch llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/stub.dll + if: ${{ startsWith(matrix.os, 'windows-') }} - run: go build - run: go test -v ./... - uses: actions/upload-artifact@v4 From db75402ade445ae32e7d4de1884149bbb8784f3a Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 27 Mar 2024 12:57:06 -0700 Subject: [PATCH 2/3] mangle arch --- .github/workflows/test.yaml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 56a02572..d8e14f0d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -153,17 +153,23 @@ jobs: go-version: '1.22' cache: false - run: | - mkdir -p llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/stub.so + case ${{ matrix.arch }} in + amd64) echo ARCH=x86_64 ;; + arm64) echo ARCH=arm64 ;; + esac >>$GITHUB_ENV + shell: bash + - run: | + mkdir -p llm/llama.cpp/build/linux/$ARCH/stub/lib/ + touch llm/llama.cpp/build/linux/$ARCH/stub/lib/stub.so if: ${{ startsWith(matrix.os, 'ubuntu-') }} - run: | - mkdir -p llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/stub.dylib + mkdir -p llm/llama.cpp/build/darwin/$ARCH/stub/lib/ + touch llm/llama.cpp/build/darwin/$ARCH/stub/lib/stub.dylib touch llm/llama.cpp/ggml-metal.metal if: ${{ startsWith(matrix.os, 'macos-') }} - run: | - mkdir -p llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/stub.dll + mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/lib/ + touch llm/llama.cpp/build/windows/$ARCH/stub/lib/stub.dll if: ${{ startsWith(matrix.os, 'windows-') }} - uses: golangci/golangci-lint-action@v3 test: @@ -190,17 +196,23 @@ jobs: cache: true - run: go get - run: | - mkdir -p llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/stub.so + case ${{ matrix.arch }} in + amd64) echo ARCH=x86_64 ;; + arm64) echo ARCH=arm64 ;; + esac >>$GITHUB_ENV + shell: bash + - run: | + mkdir -p llm/llama.cpp/build/linux/$ARCH/stub/lib/ + touch llm/llama.cpp/build/linux/$ARCH/stub/lib/stub.so if: ${{ startsWith(matrix.os, 'ubuntu-') }} - run: | - mkdir -p llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/stub.dylib + mkdir -p llm/llama.cpp/build/darwin/$ARCH/stub/lib/ + touch llm/llama.cpp/build/darwin/$ARCH/stub/lib/stub.dylib touch llm/llama.cpp/ggml-metal.metal if: ${{ startsWith(matrix.os, 'macos-') }} - run: | - mkdir -p llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/ - touch llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/stub.dll + mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/lib/ + touch llm/llama.cpp/build/windows/$ARCH/stub/lib/stub.dll if: ${{ startsWith(matrix.os, 'windows-') }} - run: go build - run: go test -v ./... From 8838ae787d6b0d903afb2cb42d40c4e7865bafc6 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 27 Mar 2024 13:49:50 -0700 Subject: [PATCH 3/3] stub stub --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d8e14f0d..9b39e0b9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -168,8 +168,8 @@ jobs: touch llm/llama.cpp/ggml-metal.metal if: ${{ startsWith(matrix.os, 'macos-') }} - run: | - mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/lib/ - touch llm/llama.cpp/build/windows/$ARCH/stub/lib/stub.dll + mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/stub/lib/ + touch llm/llama.cpp/build/windows/$ARCH/stub/stub/lib/stub.dll if: ${{ startsWith(matrix.os, 'windows-') }} - uses: golangci/golangci-lint-action@v3 test: @@ -211,8 +211,8 @@ jobs: touch llm/llama.cpp/ggml-metal.metal if: ${{ startsWith(matrix.os, 'macos-') }} - run: | - mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/lib/ - touch llm/llama.cpp/build/windows/$ARCH/stub/lib/stub.dll + mkdir -p llm/llama.cpp/build/windows/$ARCH/stub/stub/lib/ + touch llm/llama.cpp/build/windows/$ARCH/stub/stub/lib/stub.dll if: ${{ startsWith(matrix.os, 'windows-') }} - run: go build - run: go test -v ./...