ci: hello world testing with different version declarations in go.mod and go versions
This commit is contained in:
35
.github/actions/test-helloworld/action.yml
vendored
Normal file
35
.github/actions/test-helloworld/action.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: 'Test Hello World'
|
||||||
|
description: 'Test Hello World with specific Go and module versions'
|
||||||
|
inputs:
|
||||||
|
go-version:
|
||||||
|
description: 'Go version being tested'
|
||||||
|
required: true
|
||||||
|
mod-version:
|
||||||
|
description: 'Go module version to use'
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Test Hello World
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Testing with Go ${{ inputs.go-version }} and go.mod ${{ inputs.mod-version }}"
|
||||||
|
mkdir -p _test/helloworld && cd _test/helloworld
|
||||||
|
cat > go.mod << 'EOL'
|
||||||
|
module hello
|
||||||
|
go ${{ inputs.mod-version }}
|
||||||
|
EOL
|
||||||
|
cat > main.go << 'EOL'
|
||||||
|
package main
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/goplus/llgo/c"
|
||||||
|
)
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Hello, LLGo!")
|
||||||
|
println("Hello, LLGo!")
|
||||||
|
c.Printf(c.Str("Hello, LLGo!\n"))
|
||||||
|
}
|
||||||
|
EOL
|
||||||
|
go mod tidy
|
||||||
|
llgo run .
|
||||||
51
.github/workflows/llgo.yml
vendored
51
.github/workflows/llgo.yml
vendored
@@ -92,3 +92,54 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
|
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
|
||||||
bash _lldb/runtest.sh -v
|
bash _lldb/runtest.sh -v
|
||||||
|
|
||||||
|
helloworld-test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-24.04, macos-latest]
|
||||||
|
llvm: [18]
|
||||||
|
go: ['1.20', '1.21', '1.22', '1.23']
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.github/actions/setup-deps
|
||||||
|
with:
|
||||||
|
llvm-version: ${{matrix.llvm}}
|
||||||
|
|
||||||
|
- name: Set up Go 1.23 for building llgo
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.23'
|
||||||
|
|
||||||
|
- name: Install llgo
|
||||||
|
working-directory: compiler
|
||||||
|
run: |
|
||||||
|
go install ./...
|
||||||
|
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set up Go for testing
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{matrix.go}}
|
||||||
|
|
||||||
|
- name: Test Hello World with go.mod 1.20
|
||||||
|
if: matrix.go == '1.20' || matrix.go == '1.21' || matrix.go == '1.22' || matrix.go == '1.23'
|
||||||
|
uses: ./.github/actions/test-helloworld
|
||||||
|
with:
|
||||||
|
go-version: ${{matrix.go}}
|
||||||
|
mod-version: '1.20'
|
||||||
|
|
||||||
|
- name: Test Hello World with go.mod 1.21
|
||||||
|
if: matrix.go == '1.21' || matrix.go == '1.22' || matrix.go == '1.23'
|
||||||
|
uses: ./.github/actions/test-helloworld
|
||||||
|
with:
|
||||||
|
go-version: ${{matrix.go}}
|
||||||
|
mod-version: '1.21'
|
||||||
|
|
||||||
|
- name: Test Hello World with go.mod 1.22
|
||||||
|
if: matrix.go == '1.22' || matrix.go == '1.23'
|
||||||
|
uses: ./.github/actions/test-helloworld
|
||||||
|
with:
|
||||||
|
go-version: ${{matrix.go}}
|
||||||
|
mod-version: '1.22'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/goplus/llgo/compiler
|
module github.com/goplus/llgo/compiler
|
||||||
|
|
||||||
go 1.23.0
|
go 1.22.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/goplus/gogen v1.16.4
|
github.com/goplus/gogen v1.16.4
|
||||||
|
|||||||
Reference in New Issue
Block a user