* Add unit and integration tests for `Container` activity, covering behavior such as variable scoping, child activity execution, and mixed variable types. * Refactor `RunWorkflowAndCaptureOutput` method in `ContainerTests` for better code organization * Move `Sequence` activity tests to a dedicated namespace and add new unit and integration tests for enhanced coverage. - Deleted outdated `SequenceTests` and related workflows. - Introduced `SequenceActivity` namespace with improved organization. - Added comprehensive unit and integration test coverage for sequential execution, nested sequences, conditional breaking, variables, and dynamic activities. * Relocate `SequenceActivity` tests to `Activities` namespace to improve organization and update references in related test classes. * Refactor `SequenceTests` to move `DynamicSequenceWorkflow` to its own file for better test organization. * Extract `TestContainer` to `Elsa.Testing.Shared.Activities` for reuse across test projects. * Add unit and integration tests for `Break` activity; refactor workflow tests for improved organization - Introduced `BreakInForkWorkflow` and deprecated `BreakWhileForkWorkflow`. - Added `BreakTests` unit tests to validate behavior of the `Break` activity, including terminal node implementation and execution completion. - Enhanced integration tests for `Break` activity, covering multiple looping constructs (`ForEach`, `For`, `While`, `Fork`) and nested workflows. - Updated `Fork` activity to handle the `BreakSignal` asynchronously. - Simplified workflow definitions by removing redundant constructors and using concise variable initialization syntax. - Improved test clarity with better organization, comments, and consistent naming conventions. * Refactor `Fork` activity tests and workflows for improved organization and coverage - Relocated `BasicForkWorkflow` and `JoinAnyForkWorkflow` to `Fork/Workflows` namespace. - Introduced `EmptyForkWorkflow` to test Fork behavior with no branches. - Enhanced `ForkTests` with scenarios for `Fork` execution with different join modes and branch configurations. - Refactored `Fork` activity to handle empty branches and simplified `BreakSignal` handling. - Improved consistency and clarity of test cases, including better assertions and comments. * Update test/integration/Elsa.Workflows.IntegrationTests/Activities/Break/BreakTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/integration/Elsa.Workflows.IntegrationTests/Activities/Break/BreakTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/integration/Elsa.Workflows.IntegrationTests/Activities/Break/BreakTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/integration/Elsa.Workflows.IntegrationTests/Activities/Fork/ForkTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/integration/Elsa.Workflows.IntegrationTests/Activities/Fork/ForkTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update GitHub Actions workflow to use .NET 10.x * Remove outdated GitHub workflows and update configurations to .NET 10.x * Remove unused result variable assignments in integration tests (#7105) * Initial plan * Remove unused result variable assignments in BreakTests and ForkTests Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
11 KiB
Copilot Coding Agent Instructions for Elsa Workflows
Repository Overview
Elsa Workflows is a powerful .NET workflow library that enables workflow execution within any .NET application. This is version 3.0, supporting .NET 9.0 and providing both a visual designer and programmatic workflow definition capabilities.
Key Statistics
- Language: C# (.NET 9.0)
- Architecture: Modular library with 104+ projects
- Code Size: ~3,500 C# files across modules
- License: MIT
- Build System: NUKE build automation
- Target Frameworks: .NET 9.0 (primary)
High-Level Architecture
Directory Structure
src/
├── apps/ # Reference applications (5 projects)
│ ├── Elsa.Server.Web # Workflow server only
│ ├── Elsa.ServerAndStudio.Web # Combined server + studio
│ ├── Elsa.Studio.Web # Studio web interface
│ ├── ElsaStudioWebAssembly # Studio WebAssembly app
│ └── Elsa.Server.LoadBalancer # Load balancer
├── common/ # Shared libraries (8 projects)
├── modules/ # Core functionality modules (70+ projects)
│ ├── Elsa.Workflows.Core # Core workflow engine
│ ├── Elsa.Workflows.Runtime # Runtime execution
│ ├── Elsa.Workflows.Api # REST API
│ ├── Elsa.Http # HTTP activities
│ ├── Elsa.Email # Email activities
│ └── [many others] # Database, messaging, etc.
└── clients/ # API clients
test/
├── unit/ # Unit tests
├── integration/ # Integration tests
├── component/ # Component tests
└── performance/ # Performance tests
build/ # NUKE build configuration
docker/ # Docker configurations
Core Components
- Elsa.Workflows.Core: Main workflow engine and activities
- Elsa.Workflows.Runtime: Workflow execution runtime
- Elsa.Workflows.Api: RESTful API for workflow management
- Elsa.Workflows.Management: Workflow definition management
- Elsa modules: Specialized functionality (HTTP, email, scheduling, etc.)
Build Instructions
Prerequisites
- .NET 10.0 SDK
- Build time: Initial restore ~1-2 minutes, full compile ~5-10 minutes
Critical Build Information
⚠️ IMPORTANT: The repository has external dependencies that may cause build failures:
-
External NuGet Feeds: Some projects depend on packages from:
https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json(Elsa Studio packages)https://f.feedz.io/sfmskywalker/webhooks-core/nuget/index.json(Webhooks packages)
-
Build Failure Workarounds:
- Studio apps (
Elsa.Studio.Web,ElsaStudioWebAssembly,Elsa.ServerAndStudio.Web) depend on prebuilt studio packages that may not be accessible - Server app (
Elsa.Server.Web) depends on WebhooksCore package that may not be accessible - Core workflow functionality can be built independently
- Some test projects may fail due to missing external packages
- Studio apps (
Build Commands
Primary build script: ./build.sh (Linux/macOS) or .\build.cmd (Windows)
# View available targets
./build.sh --help
# Clean build artifacts
./build.sh Clean
# Restore packages (may show warnings for inaccessible feeds)
./build.sh Restore --ignore-failed-sources
# Compile core components (excludes studio apps)
./build.sh Compile
# Run tests (limited due to external dependencies)
./build.sh Test
# Create NuGet packages
./build.sh Pack
# Full CI pipeline (compile, test, pack)
./build.sh Compile Test Pack
Direct dotnet commands for core components:
# Build specific core projects that don't require external packages
dotnet restore src/modules/Elsa.Workflows.Core/ --ignore-failed-sources
dotnet build src/modules/Elsa.Workflows.Core/ --no-restore
dotnet restore src/modules/Elsa.Workflows.Runtime/ --ignore-failed-sources
dotnet build src/modules/Elsa.Workflows.Runtime/ --no-restore
# Note: Server apps may fail due to WebhooksCore dependency
# Build and test individual core modules
find test/unit -name "*.csproj" | head -5 | xargs -I {} dotnet build {}
Expected Build Warnings
NU1900: Unable to load service index for external feeds (safe to ignore)NU1801: Service index warnings for feedz.io sources (safe to ignore)
Successful Build Indicators
- Core modules (Elsa.Workflows.Core, etc.) compile successfully
- Server applications (Elsa.Server.Web) build
- Most modules show "succeeded with X warning(s)" (warnings are acceptable)
Testing
Test Structure
- Unit tests:
test/unit/- Fast, isolated tests - Integration tests:
test/integration/- End-to-end scenarios - Component tests:
test/component/- Feature testing - Performance tests:
test/performance/- Benchmarks
Running Tests
# Via NUKE build system
./build.sh Test
# Direct dotnet test (for accessible projects)
dotnet test test/unit/[specific-project]/
dotnet test --no-build --no-restore [project-path]
Note: Many tests may fail to run due to external package dependencies. Focus on core workflow engine tests that don't require studio packages.
Development Guidelines
Code Standards
- Language version: C# latest
- Target framework: .NET 10.0
- Nullable reference types: Enabled
- Implicit usings: Enabled
- EditorConfig: Configured (4-space indentation, CRLF line endings)
Architecture Patterns
- Modular design: Each feature area is a separate project/module
- Dependency injection: Heavy use of Microsoft.Extensions.DependencyInjection
- Activity-based: Workflows are built from composable activities
- Async/await: Extensive use throughout for scalability
Common Gotchas
- NuGet Source Mapping: Configured in NuGet.Config, restricts where packages can be sourced 2Multiple Target Frameworks: Some projects conditionally target different frameworks 3Build Warnings: Many NU1900/NU1801 warnings are expected and safe
Continuous Integration
GitHub Actions Workflow
- Trigger: Pull requests to
mainbranch - Runner: ubuntu-latest
- .NET Version: 10.x (latest)
- Commands:
./build.cmd Compile Test Pack - File:
.github/workflows/pr.yml(auto-generated by NUKE)
CI Pipeline Steps
- Checkout code
- Setup .NET 10.x SDK
- Execute: Compile → Test → Pack
- Expected warnings for external feed access
- Studio apps may be excluded from CI builds
Key Configuration Files
- Build:
build/Build.cs(NUKE build configuration) - Dependencies:
Directory.Packages.props(central package management) - Global settings:
Directory.Build.props - NuGet:
NuGet.Config(package sources and mapping) - Solution:
Elsa.sln(119 projects) - Docker:
docker/directory with multiple Dockerfiles - GitHub Actions:
.github/workflows/(auto-generated)
Docker Support
Multiple Docker configurations available:
ElsaServer.Dockerfile- Server onlyElsaServerAndStudio.Dockerfile- Combined server + studioElsaStudio.Dockerfile- Studio only- Docker Compose configurations for development
Quick Start for Development
-
Clone and build core components:
git clone [repo-url] cd elsa-core ./build.sh Clean Restore --ignore-failed-sources -
Work with core modules (avoid studio dependencies):
cd src/modules/Elsa.Workflows.Core dotnet build dotnet test ../../test/unit/[related-tests]/ -
Work with core modules that don't require external dependencies:
cd src/modules/Elsa.Workflows.Core dotnet restore --ignore-failed-sources dotnet build --no-restore
Running the Applications
Development Workflow Server
To run the workflow server for development:
cd src/apps/Elsa.Server.Web
dotnet restore --ignore-failed-sources
dotnet run
The server will start on the configured ports (check appsettings.json or environment variables).
Troubleshooting
Common Issues
-
Missing External Packages: If you encounter
NU1101errors for Elsa.Studio packages:- This is expected for studio-related apps
- Focus development on core workflow modules instead
- Or use Docker images that have pre-built studio components
-
Build Fails on Server Apps: If
Elsa.Server.Webfails due to WebhooksCore:- This is a known issue with external package feeds
- Try building individual core modules instead
- Use
--ignore-failed-sourcesflag consistently
-
Test Failures: If many tests fail to run:
- External package dependencies may be unavailable
- Run tests for specific core modules individually
- Focus on tests that don't require studio packages
-
Slow Initial Build: First restore and compile can take 5-10+ minutes:
- This is normal for a large solution with 100+ projects
- Subsequent builds are much faster (incremental)
- Consider building specific projects/modules when iterating
Additional Resources
Documentation
- Official Documentation: https://docs.elsaworkflows.io/
- README: See README.md for quick start and features overview
- Contributing Guide: See CONTRIBUTING.md for contribution guidelines
Community Support
- GitHub Issues: Report bugs and request features
- GitHub Discussions: Ask questions and discuss
- Discord: Join the community chat
- Stack Overflow: Tag: elsa-workflows
Enterprise Support
Important Notes for Coding Agents
- Always use
--ignore-failed-sourceswhen restoring packages - Focus on core workflow functionality
- Build warnings are normal - don't try to fix NU1900/NU1801 warnings
- Test individual modules rather than solution-wide tests when external deps fail
- Use direct dotnet commands for building specific components when NUKE fails
- Check project references before attempting builds - some projects have conditional references
- Start with core modules like
Elsa.Workflows.Core,Elsa.Workflows.Runtimewhich are more likely to build successfully
Trust these instructions for build and development workflows. Only search for additional information if these instructions are incomplete or found to be incorrect.