Skip to content

Commit

Permalink
#8816: Compilation workflow should test the setup and code generation (
Browse files Browse the repository at this point in the history
…#8817)

* Updating Compile workflow with setup and code generation steps

* Updating NHibernate reference and OrchardBasicCorrectness.ruleset path in ModuleTestsCsProj code generation template

* Ignoring CS2008 warning when recompiling with generated modules, because the theme and test projects don't have .cs files

* Generating a test project should also include packages.config

* Fixing the relative path of Orchard.Core and Orchard.Framework in the generated test project

* A bit of code styling in the Compile workflow

* Updating Readme

* Revert "A bit of code styling in the Compile workflow"

This reverts commit 7b01ebb.
  • Loading branch information
BenedekFarkas authored Dec 6, 2024
1 parent 8425b4a commit 0d93cb1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 29 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,33 @@ jobs:
uses: microsoft/setup-msbuild@v2

- name: Compile
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
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: Run Orchard setup
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
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 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:
Expand Down
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform. You are looking at Orchard 1, the older, .NET Framework-based version that has been in development since 2009.

[![Join the chat at https://gitter.im/OrchardCMS/Orchard](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OrchardCMS/Orchard?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
If you're starting a new project (or maintaining a project built on Orchard 1), you should check out [Orchard Core](https://github.com/OrchardCMS/OrchardCore), the new generation of Orchard built on ASP.NET Core. You can also try it for free on [DotNest.com](https://dotnest.com)!

You can try it for free on [DotNest.com](https://dotnest.com) or on Microsoft Azure by clicking on this button.

[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/OutercurveFoundation.OrchardCMS)
Join the community discussion on [Discord](https://orchardcore.net/discord), where we also have a [channel dedicated to Orchard 1](https://discord.com/channels/551136772243980291/551137194689953848).

## About The Orchard Project

#### Please visit our website at https://orchardproject.net for the most current information about this project.
#### Please visit our website at https://orchardcore.net for the most current information about this project.

Orchard is a free, open source, community-focused **Content Management System** built on the ASP.NET MVC platform.

Expand All @@ -24,12 +22,12 @@ Our mission is to empower our users and foster a dedicated and diverse community

Orchard is currently in version **[1.10.3](https://github.com/OrchardCMS/Orchard/releases/tag/1.10.3)**: It contains bugfixes and the more impactful changes and new features added in the latest major version (*1.10*).

We invite participation by the developer community in shaping the projects direction, so that we can publicly validate our designs and development approach.
We invite participation by the developer community in shaping the project's direction, so that we can publicly validate our designs and development approach.
All our releases are available on our [Releases](https://github.com/OrchardCMS/Orchard/releases) page, and we encourage interested developers to check out the source code on the Orchard GitHub site and get involved with the project.

* [Download the latest release](https://github.com/OrchardCMS/Orchard/releases)
* [Feature roadmap](https://docs.orchardproject.net/en/latest/Documentation/Feature-roadmap/)
* [Docs and designs/specs](https://docs.orchardproject.net)
* [Feature roadmap](https://docs.orchardcore.net/projects/O1/en/latest/Documentation/Feature-roadmap/)
* [Docs and designs/specs](https://docs.orchardcore.net/projects/O1/en/latest/)

## How To Get Involved

Expand All @@ -42,11 +40,7 @@ There are many ways you can contribute to Orchard:
* [Find and file a bug](https://github.com/OrchardCMS/Orchard/issues)
* [Propose a feature idea](https://github.com/OrchardCMS/Orchard/issues/new)
* [Ask and answer questions on Stack Overflow](https://stackoverflow.com/questions/tagged/orchardcms)
* [Participate in our gitter.im chatroom](https://gitter.im/OrchardCMS/Orchard)
* [Submit a pull request](https://docs.orchardproject.net/en/latest/Documentation/Contributing-patches/)
* [Join us on Discord](https://orchardcore.net/discord)
* [Submit a pull request](https://docs.orchardcore.net/projects/O1/en/latest/Documentation/Contributing-patches/)
* [Translate Orchard](https://crowdin.com/project/orchard-cms)
* [Contribute modules and themes to our gallery](https://gallery.orchardproject.net/)

## The Future Of Orchard CMS: Orchard Core

As the underlying frameworks (.NET, ASP.NET and ASP.NET MVC) are constantly evolving, Orchard of course keeps track of the changes and improvements of these: Orchard Core is the next generation of Orchard releases that is based on [ASP.NET Core](https://www.asp.net/core). Just like the current Orchard project, it's fully [open-source and is publicly available on GitHub](https://github.com/OrchardCMS/OrchardCore). Orchard Core (as a framework) is being built from scratch: it's still in development and does not share any of its code base (at least directly) with the current versions (1.x) of Orchard.
* [Contribute modules and themes to our gallery](https://gallery.orchardproject.net)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>..\..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand All @@ -35,16 +35,16 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\..\..\..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
<Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.2" targetFramework="net48" />
<package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
<package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
<package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,16 @@ public void CreateModuleTests(string moduleName) {
templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
File.WriteAllText(propertiesPath + "\\AssemblyInfo.cs", templateText);
content.Add(propertiesPath + "\\AssemblyInfo.cs");
File.WriteAllText(testsPath + "packages.config", File.ReadAllText(_codeGenTemplatePath + "ModuleTestsPackagesConfig.txt"));
content.Add(testsPath + "packages.config");

var itemGroup = CreateProjectItemGroup(testsPath, content, folders);

var csprojText = File.ReadAllText(_codeGenTemplatePath + "\\ModuleTestsCsProj.txt");
csprojText = csprojText.Replace("$$ProjectName$$", projectName);
csprojText = csprojText.Replace("$$TestsProjectGuid$$", projectGuid);
csprojText = csprojText.Replace("$$FileIncludes$$", itemGroup ?? "");
csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences());
csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences(modulesFolderRelativeDepth: 3));

File.WriteAllText(testsPath + projectName + ".csproj", csprojText);

Expand Down Expand Up @@ -327,15 +329,17 @@ private static string CreateCsProject(string projectName, string projectGuid, st
return text;
}

private static string GetOrchardReferences() {
private static string GetOrchardReferences(int modulesFolderRelativeDepth = 2) {
var frameworkRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth + 1));
var coreRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth));
return IsSourceEnlistment() ?
@"<ProjectReference Include=""..\..\..\Orchard\Orchard.Framework.csproj"">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
$@"<ProjectReference Include=""{frameworkRelativeDepth}\Orchard\Orchard.Framework.csproj"">
<Project>{{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}}</Project>
<Name>Orchard.Framework</Name>
<Private>$(MvcBuildViews)</Private>
</ProjectReference>
<ProjectReference Include=""..\..\Core\Orchard.Core.csproj"">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<ProjectReference Include=""{coreRelativeDepth}\Core\Orchard.Core.csproj"">
<Project>{{9916839C-39FC-4CEB-A5AF-89CA7E87119F}}</Project>
<Name>Orchard.Core</Name>
<Private>$(MvcBuildViews)</Private>
</ProjectReference>" :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<Compile Include="Services\CodeGenerationCommandInterpreter.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="CodeGenerationTemplates\ModuleTestsPackagesConfig.txt" />
<Content Include="CodeGenerationTemplates\ModuleStylesMinCss.txt" />
<Content Include="CodeGenerationTemplates\ModuleStylesCss.txt" />
<Content Include="CodeGenerationTemplates\ModuleStylesLess.txt" />
Expand Down Expand Up @@ -158,4 +159,4 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>

0 comments on commit 0d93cb1

Please sign in to comment.