move out c/cpp/py

This commit is contained in:
Li Jie
2025-04-03 15:52:18 +08:00
parent 0a8a4eb6a6
commit ed366568b4
777 changed files with 4608 additions and 139122 deletions

View File

@@ -22,9 +22,9 @@ runs:
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
cjson # for github.com/goplus/llgo/c/cjson
sqlite # for github.com/goplus/llgo/c/sqlite
python@3.12 # for github.com/goplus/llgo/py
cjson # for github.com/goplus/lib/c/cjson
sqlite # for github.com/goplus/lib/c/sqlite
python@3.12 # for github.com/goplus/lib/py
)
brew install "${opt_deps[@]}"
- name: Install Ubuntu dependencies
@@ -41,8 +41,8 @@ runs:
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
libcjson-dev # for github.com/goplus/llgo/c/cjson
libsqlite3-dev # for github.com/goplus/llgo/c/sqlite
python3.12-dev # for github.com/goplus/llgo/py
libcjson-dev # for github.com/goplus/lib/c/cjson
libsqlite3-dev # for github.com/goplus/lib/c/sqlite
python3.12-dev # for github.com/goplus/lib/py
)
sudo apt-get install -y "${opt_deps[@]}"

View File

@@ -23,7 +23,7 @@ runs:
package main
import (
"fmt"
"github.com/goplus/llgo/c"
"github.com/goplus/lib/c"
)
func main() {
fmt.Println("Hello, LLGo!")

14
.github/codecov.yml vendored
View File

@@ -1,9 +1,9 @@
coverage:
ignore:
- "compiler/chore"
- "compiler/cmd/internal"
- "compiler/internal/build"
- "compiler/internal/llgen"
- "compiler/internal/mockable"
- "compiler/internal/packages"
- "compiler/internal/typepatch"
- "chore"
- "cmd/internal"
- "internal/build"
- "internal/llgen"
- "internal/mockable"
- "internal/packages"
- "internal/typepatch"

View File

@@ -17,13 +17,3 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/compiler/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/runtime/" # Location of package manifests
schedule:
interval: "daily"

View File

@@ -19,7 +19,7 @@ jobs:
- name: Check formatting
run: |
for dir in . compiler runtime; do
for dir in . runtime; do
pushd $dir
if [ -n "$(go fmt ./...)" ]; then
echo "Some files are not properly formatted. Please run 'go fmt ./...'"

View File

@@ -19,9 +19,6 @@ jobs:
- ubuntu-24.04
llvm: [19]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: compiler
steps:
- uses: actions/checkout@v4
- name: Install dependencies

View File

@@ -34,7 +34,7 @@ jobs:
- macos-latest
- ubuntu-24.04
llvm: [19]
go: ["1.20.14", "1.21.13", "1.22.12", "1.23.6", "1.24.0"]
go: ['1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
@@ -50,8 +50,8 @@ jobs:
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/llgo/py/numpy
torch # for github.com/goplus/llgo/py/torch
numpy # for github.com/goplus/lib/py/numpy
torch # for github.com/goplus/lib/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
@@ -61,7 +61,6 @@ jobs:
go-version: "1.24.0"
- name: Install
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
@@ -71,26 +70,11 @@ jobs:
with:
go-version: ${{matrix.go}}
- name: Verify Go version
run: |
go_version=$(go version | cut -d' ' -f3 | sed 's/go//')
if [[ "$go_version" != "${{matrix.go}}"* ]]; then
echo "Expected Go version ${{matrix.go}}, but got $go_version"
exit 1
fi
echo "Using Go version: $go_version"
- name: _xtool build tests
run: |
cd _xtool
llgo build -v ./...
- name: LLGO tests
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 demos
run: |
# TODO(lijie): force python3-embed to be linked with python-3.12-embed
@@ -109,7 +93,6 @@ jobs:
- name: LLDB tests
if: ${{startsWith(matrix.os, 'macos')}}
working-directory: compiler
run: |
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
bash _lldb/runtest.sh -v
@@ -133,8 +116,8 @@ jobs:
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/llgo/py/numpy
torch # for github.com/goplus/llgo/py/torch
numpy # for github.com/goplus/lib/py/numpy
torch # for github.com/goplus/lib/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
@@ -144,7 +127,6 @@ jobs:
go-version: "1.24.0"
- name: Install
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
@@ -154,15 +136,6 @@ jobs:
with:
go-version: ${{matrix.go}}
- name: Verify Go version
run: |
go_version=$(go version | cut -d' ' -f3 | sed 's/go//')
if [[ "$go_version" != "${{matrix.go}}"* ]]; then
echo "Expected Go version ${{matrix.go}}, but got $go_version"
exit 1
fi
echo "Using Go version: $go_version"
- name: run llgo test
run: |
llgo test ./...
@@ -175,7 +148,7 @@ jobs:
matrix:
os: [ubuntu-24.04, macos-latest]
llvm: [19]
go: ["1.20.14", "1.21.13", "1.22.12", "1.23.6", "1.24.0"]
go: ['1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
@@ -190,7 +163,6 @@ jobs:
go-version: "1.24.0"
- name: Install llgo
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
@@ -200,13 +172,6 @@ jobs:
with:
go-version: ${{matrix.go}}
- name: Test Hello World with go.mod 1.20
if: startsWith(matrix.go, '1.20') || startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.20"
- name: Test Hello World with go.mod 1.21
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld

View File

@@ -1,36 +0,0 @@
#!/bin/bash
set -e
testcmd=/tmp/test
llgo build -o $testcmd ./c/bdwgc/_test
cases=$($testcmd)
total=$(echo "$cases" | wc -l | tr -d ' ')
failed=0
failed_cases=""
for idx in $(seq 1 $((total))); do
case=$(echo "$cases" | sed -n "${idx}p")
case_name=$(echo "$case" | cut -d',' -f2)
echo "=== Test case: $case_name"
set +e
out=$("$testcmd" "$((idx-1))" 2>&1)
exit_code=$?
set -e
if [ "${exit_code:-0}" -ne 0 ]; then
echo "failed: $out"
failed=$((failed+1))
failed_cases="$failed_cases\n* :x: $case_name"
else
echo "passed"
fi
done
echo "=== Done"
echo "$((total-failed))/$total tests passed"
if [ "$failed" -ne 0 ]; then
echo ":bangbang: Failed llgo cases:" | tee -a result.md
echo -e "$failed_cases" | tee -a result.md
exit 1
else
echo ":white_check_mark: All llgo tests passed" | tee -a result.md
fi