From a4ec6cce96ef34337f1e5db2a07c4ffc100cd259 Mon Sep 17 00:00:00 2001 From: Aofei Sheng Date: Wed, 31 Jul 2024 10:49:07 +0800 Subject: [PATCH] ci: install further optional dependencies for demos Achieved 100% pass rate for demo tests, at least on macOS. --- .github/workflows/go.yml | 23 +++++++++++++++-------- .github/workflows/test_demo.sh | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9a412391..1de5cc8e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -58,6 +58,15 @@ jobs: ) sudo apt-get install -y "${opt_deps[@]}" + - name: Install further optional dependencies for demos + run: | + wget -P ./_demo/llama2-c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin + py_deps=( + numpy # for github.com/goplus/llgo/py/numpy + torch # for github.com/goplus/llgo/py/torch + ) + pip3 install --break-system-packages "${py_deps[@]}" + - name: Clang information run: | echo $PATH @@ -73,27 +82,25 @@ jobs: run: go build -v ./... - name: Test - if: matrix.os != 'macos-latest' + if: ${{!startsWith(matrix.os, 'macos')}} run: go test -v ./... - name: Test with coverage - if: matrix.os == 'macos-latest' + if: startsWith(matrix.os, 'macos') run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./... - name: Install run: go install ./... - name: LLGO tests - if: matrix.os != 'ubuntu-latest' + if: ${{!startsWith(matrix.os, 'ubuntu')}} run: | echo "Test result on ${{matrix.os}} with LLVM ${{matrix.llvm}}" > result.md bash .github/workflows/test_llgo.sh - - name: Test _demo and _pydemo - run: | - set +e - bash .github/workflows/test_demo.sh - exit 0 + - name: Test demos + continue-on-error: true + run: bash .github/workflows/test_demo.sh - name: Show test result run: cat result.md diff --git a/.github/workflows/test_demo.sh b/.github/workflows/test_demo.sh index c707b00e..8e947f6a 100644 --- a/.github/workflows/test_demo.sh +++ b/.github/workflows/test_demo.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # llgo run subdirectories under _demo and _pydemo total=0 @@ -8,7 +9,7 @@ for d in ./_demo/* ./_pydemo/*; do total=$((total+1)) if [ -d "$d" ]; then echo "Testing $d" - if ! llgo run "$d"; then + if ! (cd "$d" && llgo run .); then echo "FAIL" failed=$((failed+1)) failed_cases="$failed_cases\n* :x: $d"