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) Successful in 47s
Go Test / go-test (push) Successful in 20s
Java Test / java-hello (push) Successful in 29s
Julia Test / julia-test (push) Successful in 16s
Kotlin Test / kotlin-hello (push) Successful in 40s
Node.js Test / nodejs-test (push) Failing after 6s
Notebook Test / nb-test (push) Failing after 8s
PHP Test / php-test (push) Successful in 37s
Python Test / python-hello (push) Successful in 4s
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) Successful in 47s
Go Test / go-test (push) Successful in 20s
Java Test / java-hello (push) Successful in 29s
Julia Test / julia-test (push) Successful in 16s
Kotlin Test / kotlin-hello (push) Successful in 40s
Node.js Test / nodejs-test (push) Failing after 6s
Notebook Test / nb-test (push) Failing after 8s
PHP Test / php-test (push) Successful in 37s
Python Test / python-hello (push) Successful in 4s
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:
@@ -19,22 +19,20 @@ jobs:
|
|||||||
- name: Run tests (use module/workspace if present; else fallback)
|
- name: Run tests (use module/workspace if present; else fallback)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -euo pipefail
|
||||||
if [ -f go.mod ] || [ -f go.work ]; then
|
if [ -f go.mod ] || [ -f go.work ]; then
|
||||||
[ -f go.work ] && go work sync
|
[ -f go.work ] && go work sync
|
||||||
go test ./...
|
go test ./...
|
||||||
else
|
else
|
||||||
echo "No go.mod or go.work found; creating a tiny module for a smoke test."
|
echo "No go.mod or go.work found; creating a tiny module for a smoke test."
|
||||||
cat > main.go <<'EOF'
|
printf '%s\n' \
|
||||||
package main
|
'package main' \
|
||||||
import "fmt"
|
'import "fmt"' \
|
||||||
func main(){ fmt.Println("hello") }
|
'func main(){ fmt.Println("hello") }' > main.go
|
||||||
EOF
|
printf '%s\n' \
|
||||||
cat > main_test.go <<'EOF'
|
'package main' \
|
||||||
package main
|
'import "testing"' \
|
||||||
import "testing"
|
'func TestMath(t *testing.T){ if 2+2 != 4 { t.Fatal("bad math") } }' > main_test.go
|
||||||
func TestMath(t *testing.T){ if 2+2 != 4 { t.Fatal("bad math") } }
|
|
||||||
EOF
|
|
||||||
go mod init example.com/ci
|
go mod init example.com/ci
|
||||||
go test ./...
|
go test ./...
|
||||||
fi
|
fi
|
Reference in New Issue
Block a user