mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Merge branch 'v2_develop' into v2_release
This commit is contained in:
79
.github/workflows/README.md
vendored
Normal file
79
.github/workflows/README.md
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
## CI/CD Workflows
|
||||
|
||||
The repository uses multiple GitHub Actions workflows. What runs and when:
|
||||
|
||||
### 1) Build Solution (`.github/workflows/build.yml`)
|
||||
|
||||
- **Triggers**: push and pull_request to `v2_release`, `v2_develop` (ignores `**.md`); supports `workflow_call`
|
||||
- **Runner/timeout**: `ubuntu-latest`, 10 minutes
|
||||
- **Steps**:
|
||||
- Checkout and setup .NET 8.x GA
|
||||
- `dotnet restore`
|
||||
- Build Debug: `dotnet build --configuration Debug --no-restore -property:NoWarn=0618%3B0612`
|
||||
- Build Release (library): `dotnet build Terminal.Gui/Terminal.Gui.csproj --configuration Release --no-incremental --force -property:NoWarn=0618%3B0612`
|
||||
- Pack Release: `dotnet pack Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ./local_packages -property:NoWarn=0618%3B0612`
|
||||
- Restore NativeAot/SelfContained examples, then restore solution again
|
||||
- Build Release for `Examples/NativeAot` and `Examples/SelfContained`
|
||||
- Build Release solution
|
||||
- Upload artifacts named `build-artifacts`, retention 1 day
|
||||
|
||||
### 2) Build & Run Unit Tests (`.github/workflows/unit-tests.yml`)
|
||||
|
||||
- **Triggers**: push and pull_request to `v2_release`, `v2_develop` (ignores `**.md`)
|
||||
- **Matrix**: Ubuntu/Windows/macOS
|
||||
- **Timeout**: 15 minutes per job
|
||||
- **Process**:
|
||||
1. Calls build workflow to build solution once
|
||||
2. Downloads build artifacts
|
||||
3. Runs `dotnet restore` (required for `--no-build` to work)
|
||||
4. **Performance optimizations**:
|
||||
- Disables Windows Defender on Windows runners (significant speedup)
|
||||
- Collects code coverage **only on Linux** (ubuntu-latest) for performance
|
||||
- Windows and macOS skip coverage collection to reduce test time
|
||||
- Increased blame-hang-timeout to 120s for Windows/macOS (60s for Linux)
|
||||
5. Runs two test jobs:
|
||||
- **Non-parallel UnitTests**: `Tests/UnitTests` with blame/diag flags; `xunit.stopOnFail=false`
|
||||
- **Parallel UnitTestsParallelizable**: `Tests/UnitTestsParallelizable` with blame/diag flags; `xunit.stopOnFail=false`
|
||||
6. Uploads test logs and diagnostic data from all runners
|
||||
7. **Uploads code coverage to Codecov only from Linux runner**
|
||||
|
||||
**Test results**: All tests output to unified `TestResults/` directory at repository root
|
||||
|
||||
### 3) Build & Run Integration Tests (`.github/workflows/integration-tests.yml`)
|
||||
|
||||
- **Triggers**: push and pull_request to `v2_release`, `v2_develop` (ignores `**.md`)
|
||||
- **Matrix**: Ubuntu/Windows/macOS
|
||||
- **Timeout**: 15 minutes
|
||||
- **Process**:
|
||||
1. Calls build workflow
|
||||
2. Downloads build artifacts
|
||||
3. Runs `dotnet restore`
|
||||
4. **Performance optimizations** (same as unit tests):
|
||||
- Disables Windows Defender on Windows runners
|
||||
- Collects code coverage **only on Linux**
|
||||
- Increased blame-hang-timeout to 120s for Windows/macOS
|
||||
5. Runs IntegrationTests with blame/diag flags; `xunit.stopOnFail=true`
|
||||
6. Uploads logs per-OS
|
||||
7. **Uploads coverage to Codecov only from Linux runner**
|
||||
|
||||
### 4) Publish to NuGet (`.github/workflows/publish.yml`)
|
||||
|
||||
- **Triggers**: push to `v2_release`, `v2_develop`, and tags `v*`(ignores `**.md`)
|
||||
- Uses GitVersion to compute SemVer, builds Release, packs with symbols, and pushes to NuGet.org using `NUGET_API_KEY`
|
||||
|
||||
### 5) Build and publish API docs (`.github/workflows/api-docs.yml`)
|
||||
|
||||
- **Triggers**: push to `v1_release` and `v2_develop`
|
||||
- Builds DocFX site on Windows and deploys to GitHub Pages when `ref_name` is `v2_release` or `v2_develop`
|
||||
|
||||
|
||||
### Replicating CI Locally
|
||||
|
||||
```bash
|
||||
# Full CI sequence:
|
||||
dotnet restore
|
||||
dotnet build --configuration Debug --no-restore
|
||||
dotnet test Tests/UnitTests --no-build --verbosity normal
|
||||
dotnet test Tests/UnitTestsParallelizable --no-build --verbosity normal
|
||||
dotnet build --configuration Release --no-restore
|
||||
```
|
||||
102
.github/workflows/unit-tests.yml
vendored
102
.github/workflows/unit-tests.yml
vendored
@@ -120,7 +120,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
@@ -154,35 +154,81 @@ jobs:
|
||||
shell: bash
|
||||
run: echo "VSTEST_DUMP_PATH=logs/UnitTestsParallelizable/${{ runner.os }}/" >> $GITHUB_ENV
|
||||
|
||||
- name: Run UnitTestsParallelizable
|
||||
- name: Run UnitTestsParallelizable (10 iterations with varying parallelization)
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ runner.os }}" == "Linux" ]; then
|
||||
# Run with coverage on Linux only
|
||||
dotnet test Tests/UnitTestsParallelizable \
|
||||
--no-build \
|
||||
--verbosity normal \
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--settings Tests/UnitTests/runsettings.coverage.xml \
|
||||
--diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
|
||||
--blame \
|
||||
--blame-crash \
|
||||
--blame-hang \
|
||||
--blame-hang-timeout 60s \
|
||||
--blame-crash-collect-always
|
||||
else
|
||||
# Run without coverage on Windows/macOS for speed
|
||||
dotnet test Tests/UnitTestsParallelizable \
|
||||
--no-build \
|
||||
--verbosity normal \
|
||||
--settings Tests/UnitTestsParallelizable/runsettings.xml \
|
||||
--diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
|
||||
--blame \
|
||||
--blame-crash \
|
||||
--blame-hang \
|
||||
--blame-hang-timeout 60s \
|
||||
--blame-crash-collect-always
|
||||
fi
|
||||
# Run tests 3 times with different parallelization settings to expose concurrency issues
|
||||
for RUN in {1..3}; do
|
||||
echo "============================================"
|
||||
echo "Starting test run $RUN of 3"
|
||||
echo "============================================"
|
||||
|
||||
# Use a combination of run number and timestamp to create different execution patterns
|
||||
SEED=$((1000 + $RUN + $(date +%s) % 1000))
|
||||
echo "Using randomization seed: $SEED"
|
||||
|
||||
# Vary the xUnit parallelization based on run number to expose race conditions
|
||||
# Runs 1-3: Default parallelization (2x CPU cores)
|
||||
# Runs 4-6: Max parallelization (unlimited)
|
||||
# Runs 7-9: Single threaded (1)
|
||||
# Run 10: Random (1-4 threads)
|
||||
if [ $RUN -le 3 ]; then
|
||||
XUNIT_MAX_PARALLEL_THREADS="2x"
|
||||
echo "Run $RUN: Using default parallelization (2x)"
|
||||
elif [ $RUN -le 6 ]; then
|
||||
XUNIT_MAX_PARALLEL_THREADS="unlimited"
|
||||
echo "Run $RUN: Using maximum parallelization (unlimited)"
|
||||
elif [ $RUN -le 9 ]; then
|
||||
XUNIT_MAX_PARALLEL_THREADS="1"
|
||||
echo "Run $RUN: Using single-threaded execution"
|
||||
else
|
||||
# Random parallelization based on seed
|
||||
PROC_COUNT=$(( ($SEED % 4) + 1 ))
|
||||
XUNIT_MAX_PARALLEL_THREADS="$PROC_COUNT"
|
||||
echo "Run $RUN: Using random parallelization with $PROC_COUNT threads"
|
||||
fi
|
||||
|
||||
# Run tests with or without coverage based on OS and run number
|
||||
if [ "${{ runner.os }}" == "Linux" ] && [ $RUN -eq 1 ]; then
|
||||
echo "Run $RUN: Running with coverage collection"
|
||||
dotnet test Tests/UnitTestsParallelizable \
|
||||
--no-build \
|
||||
--verbosity normal \
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--settings Tests/UnitTests/runsettings.coverage.xml \
|
||||
--diag:logs/UnitTestsParallelizable/${{ runner.os }}/run${RUN}-logs.txt \
|
||||
--blame \
|
||||
--blame-crash \
|
||||
--blame-hang \
|
||||
--blame-hang-timeout 60s \
|
||||
--blame-crash-collect-always \
|
||||
-- xUnit.MaxParallelThreads=${XUNIT_MAX_PARALLEL_THREADS}
|
||||
else
|
||||
dotnet test Tests/UnitTestsParallelizable \
|
||||
--no-build \
|
||||
--verbosity normal \
|
||||
--settings Tests/UnitTestsParallelizable/runsettings.xml \
|
||||
--diag:logs/UnitTestsParallelizable/${{ runner.os }}/run${RUN}-logs.txt \
|
||||
--blame \
|
||||
--blame-crash \
|
||||
--blame-hang \
|
||||
--blame-hang-timeout 60s \
|
||||
--blame-crash-collect-always \
|
||||
-- xUnit.MaxParallelThreads=${XUNIT_MAX_PARALLEL_THREADS}
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Test run $RUN failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Test run $RUN completed successfully"
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "============================================"
|
||||
echo "All 10 test runs completed successfully!"
|
||||
echo "============================================"
|
||||
|
||||
- name: Upload UnitTestsParallelizable Logs
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user