test: run _demo/* and _pydemo/*
This commit is contained in:
88
.github/workflows/go.yml
vendored
88
.github/workflows/go.yml
vendored
@@ -11,22 +11,32 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test-macos:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, macos-12, macos-13]
|
os: [macos-latest, macos-12, macos-13, ubuntu-latest]
|
||||||
llvm: [17]
|
llvm: [17]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update Homebrew
|
- name: Update Homebrew
|
||||||
if: matrix.llvm == 17 # needed as long as LLVM 17 is still fresh
|
# needed as long as LLVM 17 is still fresh
|
||||||
|
if: matrix.llvm == 17 && startsWith(matrix.os, 'macos')
|
||||||
run: brew update
|
run: brew update
|
||||||
- name: Install LLVM ${{ matrix.llvm }} and bdw-gc
|
- name: Install LLVM ${{ matrix.llvm }} and bdw-gc
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
run: |
|
run: |
|
||||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }} bdw-gc
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }} bdw-gc
|
||||||
echo `brew --prefix llvm@${{ matrix.llvm }}`/bin >> $GITHUB_PATH
|
echo `brew --prefix llvm@${{ matrix.llvm }}`/bin >> $GITHUB_PATH
|
||||||
|
- name: Install LLVM ${{ matrix.llvm }} and libgc-dev
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{ matrix.llvm }} main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||||
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install --no-install-recommends clang-${{ matrix.llvm }} llvm-${{ matrix.llvm }}-dev libgc-dev
|
||||||
|
echo /usr/lib/llvm-${{ matrix.llvm }}/bin >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Clang information
|
- name: Clang information
|
||||||
run: |
|
run: |
|
||||||
@@ -43,59 +53,35 @@ jobs:
|
|||||||
run: go build -v ./...
|
run: go build -v ./...
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
|
if: matrix.os != 'ubuntu-latest'
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
- name: Test with coverage
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./...
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
run: go install ./...
|
run: go install ./...
|
||||||
|
|
||||||
- name: LLGO tests
|
- name: LLGO tests
|
||||||
run: |
|
run: |
|
||||||
export LLGOROOT=$PWD
|
echo "Test result on ${{ matrix.os }} with LLVM ${{ matrix.llvm }}" > result.txt
|
||||||
bash _test/run.sh
|
LLGOROOT=$PWD bash .github/workflows/test_llgo.sh
|
||||||
|
|
||||||
test-linux:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
llvm: [17]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install LLVM ${{ matrix.llvm }} and libgc-dev
|
|
||||||
run: |
|
|
||||||
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{ matrix.llvm }} main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install --no-install-recommends clang-${{ matrix.llvm }} llvm-${{ matrix.llvm }}-dev libgc-dev
|
|
||||||
echo /usr/lib/llvm-${{ matrix.llvm }}/bin >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Clang information
|
|
||||||
run: |
|
|
||||||
echo $PATH
|
|
||||||
which clang
|
|
||||||
clang --version
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.20'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: go build -v ./...
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./...
|
|
||||||
|
|
||||||
- name: Install
|
|
||||||
run: go install ./...
|
|
||||||
|
|
||||||
- name: LLGO tests
|
- name: Test _demo and _pydemo
|
||||||
run: |
|
run: |
|
||||||
export LLGOROOT=$PWD
|
set +e
|
||||||
bash _test/run.sh
|
LLGOROOT=$PWD bash .github/workflows/test_demo.sh
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Upload coverage reports to Codecov
|
- name: PR comment with test result
|
||||||
uses: codecov/codecov-action@v4
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
filePath: result.md
|
||||||
slug: goplus/llgo
|
create_if_not_exists: true
|
||||||
|
comment_tag: test-result-on-${{ matrix.os }}-with-llvm-${{ matrix.llvm }}
|
||||||
|
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
slug: goplus/llgo
|
||||||
|
|||||||
26
.github/workflows/test_demo.sh
vendored
Normal file
26
.github/workflows/test_demo.sh
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# llgo run subdirectories under _demo and _pydemo
|
||||||
|
total=0
|
||||||
|
failed=0
|
||||||
|
failed_cases=""
|
||||||
|
for d in ./_demo/* ./_pydemo/*; do
|
||||||
|
total=$((total+1))
|
||||||
|
if [ -d "$d" ]; then
|
||||||
|
echo "Testing $d"
|
||||||
|
if ! llgo run -v "$d"; then
|
||||||
|
echo "FAIL"
|
||||||
|
failed=$((failed+1))
|
||||||
|
failed_cases="$failed_cases\n$d"
|
||||||
|
else
|
||||||
|
echo "PASS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "=== Done"
|
||||||
|
echo "$((total-failed))/$total tests passed"
|
||||||
|
if [ "$failed" -ne 0 ]; then
|
||||||
|
echo -e "Failed cases:$failed_cases"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -7,7 +7,6 @@ total=$(echo "$cases" | wc -l | tr -d ' ')
|
|||||||
succ=0
|
succ=0
|
||||||
for idx in $(seq 1 $((total))); do
|
for idx in $(seq 1 $((total))); do
|
||||||
case=$(echo "$cases" | sed -n "${idx}p")
|
case=$(echo "$cases" | sed -n "${idx}p")
|
||||||
case_id=$(echo "$case" | cut -d',' -f1)
|
|
||||||
case_name=$(echo "$case" | cut -d',' -f2)
|
case_name=$(echo "$case" | cut -d',' -f2)
|
||||||
echo "=== Test case: $case_name"
|
echo "=== Test case: $case_name"
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
Reference in New Issue
Block a user