Update .gitea/workflows/go-test.yml
Some checks failed
CI Demo / build (push) Successful in 3s
Docker Test / docker-ops (push) Successful in 5s
.NET Test / dotnet-test (push) Failing after 16s
Go Test / go-test (push) Failing after 32s
Julia Test / julia-test (push) Has been cancelled
Kotlin Test / kotlin-hello (push) Has been cancelled
Java Test / java-hello (push) Has been cancelled
Node.js Test / nodejs-test (push) Has been cancelled
Notebook Test / nb-test (push) Has been cancelled
PHP Test / php-test (push) Has been cancelled
Python Test / python-hello (push) Has been cancelled
R Test / r-cmdcheck (push) Has been cancelled
Rust Test / rust-test (push) Has been cancelled
Scala Test / scala-test (push) Has been cancelled
Swift Test / swift-hello (push) Has been cancelled
Some checks failed
CI Demo / build (push) Successful in 3s
Docker Test / docker-ops (push) Successful in 5s
.NET Test / dotnet-test (push) Failing after 16s
Go Test / go-test (push) Failing after 32s
Julia Test / julia-test (push) Has been cancelled
Kotlin Test / kotlin-hello (push) Has been cancelled
Java Test / java-hello (push) Has been cancelled
Node.js Test / nodejs-test (push) Has been cancelled
Notebook Test / nb-test (push) Has been cancelled
PHP Test / php-test (push) Has been cancelled
Python Test / python-hello (push) Has been cancelled
R Test / r-cmdcheck (push) Has been cancelled
Rust Test / rust-test (push) Has been cancelled
Scala Test / scala-test (push) Has been cancelled
Swift Test / swift-hello (push) Has been cancelled
This commit is contained in:
@@ -5,13 +5,35 @@ jobs:
|
||||
go-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
go-version: '1.22.x'
|
||||
check-latest: true
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./...
|
||||
- name: Verify Go
|
||||
run: go version
|
||||
|
||||
- name: Run tests (use module/workspace if present; else fallback)
|
||||
run: |
|
||||
set -e
|
||||
if [ -f go.mod ] || [ -f go.work ]; then
|
||||
[ -f go.work ] && go work sync
|
||||
go test ./...
|
||||
else
|
||||
echo "No go.mod or go.work found; creating a tiny module for a smoke test."
|
||||
cat > main.go <<'EOF'
|
||||
package main
|
||||
import "fmt"
|
||||
func main(){ fmt.Println("hello") }
|
||||
EOF
|
||||
cat > main_test.go <<'EOF'
|
||||
package main
|
||||
import "testing"
|
||||
func TestMath(t *testing.T){ if 2+2 != 4 { t.Fatal("bad math") } }
|
||||
EOF
|
||||
go mod init example.com/ci
|
||||
go test ./...
|
||||
fi
|
Reference in New Issue
Block a user