name: Compile # Compiles the solution and runs unit tests. on: workflow_dispatch: pull_request: push: branches: - dev - 1.10.x jobs: compile-dotnet: name: Compile .NET solution defaults: run: shell: cmd runs-on: windows-2025 steps: - name: Clone Repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Restore NuGet Packages run: nuget restore src/Orchard.sln - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 - name: Compile run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /p:MvcBuildViews=true - name: Test run: msbuild Orchard.proj /m /v:minimal /t:Test - name: Test Setup with SpecFlow shell: pwsh run: | $nunitConsole = (Get-ChildItem -Path 'src/packages' -Recurse -Filter 'nunit-console.exe' | Select-Object -Last 1).FullName & $nunitConsole 'build/Compile/Orchard.Specs.dll' /xml='build/Orchard.Specs.xml' /run=Orchard.Specs.SetupFeature.RootAndSetupFolderShowsSetupScreenAndFormValuesAreValidated - name: Run Orchard Setup with Orchard.exe shell: pwsh run: | $commandFile = 'src/Orchard.Web/bin/setup-commands.txt' New-Item -Path $commandFile -ItemType File -Force Set-Content -Path $commandFile -Value 'setup /SiteName:Orchard /AdminUsername:admin /AdminPassword:Password1! /DatabaseProvider:SqlCe /Recipe:Default' & 'src/Orchard.Web/bin/Orchard.exe' @$commandFile - name: Run Code Generation shell: pwsh run: | $commandFile = 'src/Orchard.Web/bin/codegen-commands.txt' New-Item -Path $commandFile -ItemType File -Force Set-Content -Path $commandFile -Value @' feature enable Orchard.CodeGeneration codegen module Orchard.CodeGeneration.TestModule codegen theme Orchard.CodeGeneration.TestTheme /CreateProject:true codegen moduletests Orchard.CodeGeneration.TestModule '@ & 'src/Orchard.Web/bin/Orchard.exe' @$commandFile - name: Compile Again with Generated Projects run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /NoWarn:CS2008 compile-node: name: Compile Client-side Assets defaults: run: shell: cmd runs-on: windows-2025 steps: - name: Clone Repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup NodeJS uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: node-version: 7 - name: Install Gulp Globally working-directory: ./src shell: pwsh run: | # Install gulp globally to be able to run the rebuild task, using the same version as in the project. $gulpVersion = (Get-Content Package.json -Raw | ConvertFrom-Json).devDependencies.gulp Start-Process npm -NoNewWindow -Wait -ArgumentList "install gulp@$gulpVersion -g --loglevel warn" - name: Install NPM Packages working-directory: ./src run: npm install --loglevel warn - name: Rebuild Client-side Assets working-directory: ./src run: gulp rebuild - name: Check Client-side Assets working-directory: ./src shell: pwsh run: | git add . # To make line ending changes "disappear". $gitStatus = (git status --porcelain) if ($gitStatus) { throw ("Client-side assets are not up-to-date. Please run 'gulp rebuild' and commit the changes.`n" + [System.String]::Join([System.Environment]::NewLine, $gitStatus)) }