Update .gitea/workflows/dotnet-test.yml
Some checks failed
CI Demo / build (push) Successful in 3s
Go Test / go-test (push) Has been cancelled
Java Test / java-hello (push) Has been cancelled
Julia Test / julia-test (push) Has been cancelled
Docker Test / docker-ops (push) Has been cancelled
Kotlin Test / kotlin-hello (push) Has been cancelled
Node.js Test / nodejs-test (push) Has been cancelled
Notebook Test / nb-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
PHP Test / php-test (push) Successful in 35s
Some checks failed
CI Demo / build (push) Successful in 3s
Go Test / go-test (push) Has been cancelled
Java Test / java-hello (push) Has been cancelled
Julia Test / julia-test (push) Has been cancelled
Docker Test / docker-ops (push) Has been cancelled
Kotlin Test / kotlin-hello (push) Has been cancelled
Node.js Test / nodejs-test (push) Has been cancelled
Notebook Test / nb-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
PHP Test / php-test (push) Successful in 35s
This commit is contained in:
@@ -15,14 +15,16 @@ jobs:
|
|||||||
- name: Set up .NET
|
- name: Set up .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x' # or '7.0.x' if you prefer
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
- name: Detect & build/test
|
- name: Detect & build/test
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
has_solution=false
|
has_solution=false
|
||||||
# Find any .sln or .csproj
|
# Group the -name tests so -o doesn’t mess with precedence
|
||||||
if find . -maxdepth 2 -name '*.sln' -o -name '*.csproj' | grep -q .; then
|
if find . -maxdepth 2 \( -name '*.sln' -o -name '*.csproj' \) | grep -q .; then
|
||||||
has_solution=true
|
has_solution=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ jobs:
|
|||||||
echo "Detected .NET project; restoring/building/testing..."
|
echo "Detected .NET project; restoring/building/testing..."
|
||||||
dotnet restore
|
dotnet restore
|
||||||
dotnet build --no-restore -c Release
|
dotnet build --no-restore -c Release
|
||||||
# Run tests if there are any test projects; otherwise just succeed after build
|
# Run tests if any project is a test project
|
||||||
if find . -name '*Tests.csproj' -o -name '*.csproj' -exec grep -l '<IsTestProject>true</IsTestProject>' {} + | grep -q .; then
|
if find . -name '*Tests.csproj' -o -name '*.csproj' -exec grep -l '<IsTestProject>true</IsTestProject>' {} + | grep -q .; then
|
||||||
dotnet test --no-build -c Release --verbosity normal
|
dotnet test --no-build -c Release --verbosity normal
|
||||||
else
|
else
|
||||||
@@ -44,6 +46,7 @@ jobs:
|
|||||||
dotnet sln HelloCI.sln add src/App/App.csproj tests/App.Tests/App.Tests.csproj
|
dotnet sln HelloCI.sln add src/App/App.csproj tests/App.Tests/App.Tests.csproj
|
||||||
dotnet add tests/App.Tests/App.Tests.csproj reference src/App/App.csproj
|
dotnet add tests/App.Tests/App.Tests.csproj reference src/App/App.csproj
|
||||||
|
|
||||||
|
# Heredoc terminator must start at column 0 — no indentation
|
||||||
cat > tests/App.Tests/UnitTest1.cs <<'EOF'
|
cat > tests/App.Tests/UnitTest1.cs <<'EOF'
|
||||||
using Xunit;
|
using Xunit;
|
||||||
namespace App.Tests;
|
namespace App.Tests;
|
||||||
|
Reference in New Issue
Block a user