Skip to content

Commit

Permalink
Merge branch 'main' into tbNews
Browse files Browse the repository at this point in the history
  • Loading branch information
urbanit committed Mar 30, 2024
2 parents 6b446a0 + 861be5f commit 6ba53ac
Show file tree
Hide file tree
Showing 106 changed files with 704 additions and 622 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Main - CI
on:
push:
paths-ignore:
- '**/*.md'
- 'mkdocs.yml'
- 'src/docs/**/*'
branches: [ main ]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
runs-on: ${{ matrix.os }}
name: Build & Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "15"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Build
run: |
dotnet build -c Release
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
- name: Functional Tests
if: matrix.os == 'ubuntu-latest'
run: |
cd test/OrchardCore.Tests.Functional
npm install
npm run cms:test
npm run mvc:test
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && failure()
with:
name: Functional Test failure
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
50 changes: 28 additions & 22 deletions .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,75 @@
name: Preview - CI
on:
push:
paths-ignore:
- '**/*.md'
- 'mkdocs.yml'
- 'src/docs/**/*'
branches: [ main ]
workflow_dispatch:
schedule:
# 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions.
- cron: '19 4 * * *'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
name: Build, Test, Deploy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check if should publish
id: check-publish
shell: pwsh
run: |
$hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago'))
Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay."
$shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule'
"should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT
- uses: actions/setup-node@v3
if: steps.check-publish.outputs.should-publish == 'true'
with:
node-version: "15"
- uses: actions/setup-dotnet@v3
if: steps.check-publish.outputs.should-publish == 'true'
with:
dotnet-version: '8.0.x'
- name: Set build number
if: matrix.os == 'ubuntu-latest'
- name: Set build number
if: steps.check-publish.outputs.should-publish == 'true'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV
- name: Build
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet build -c Release
- name: Unit Tests
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
- name: Functional Tests
if: matrix.os == 'ubuntu-latest'
if: steps.check-publish.outputs.should-publish == 'true'
run: |
cd test/OrchardCore.Tests.Functional
npm install
npm run cms:test
npm run mvc:test
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && failure()
if: failure()
with:
name: Functional Test failure
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
- name: Deploy preview nuget packages
if: matrix.os == 'ubuntu-latest'
- name: Deploy preview NuGet packages
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet pack -c Release --no-build
dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate
- name: Set up Docker Buildx
if: matrix.os == 'ubuntu-latest'
if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: matrix.os == 'ubuntu-latest'
if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy preview docker images
if: matrix.os == 'ubuntu-latest'
- name: Deploy preview Docker images
if: steps.check-publish.outputs.should-publish == 'true'
shell: pwsh
run: |
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Orchard Core consists of two distinct projects:

## Build Status

Stable (release/1.8.2):
Stable (`release/1.8.2`):

[![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/release_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Release+-+CI%22)
[![NuGet](https://img.shields.io/nuget/v/OrchardCore.Application.Cms.Targets.svg)](https://www.nuget.org/packages/OrchardCore.Application.Cms.Targets)

Nightly (main):
Nightly (`main`):

[![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/preview_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Preview+-+CI%22)
[![Cloudsmith](https://api-prd.cloudsmith.io/badges/version/orchardcore/preview/nuget/OrchardCore.Application.Cms.Targets/latest/x/?render=true&badge_token=gAAAAABey9hKFD_C-ZIpLvayS3HDsIjIorQluDs53KjIdlxoDz6Ntt1TzvMNJp7a_UWvQbsfN5nS7_0IbxCyqHZsjhmZP6cBkKforo-NqwrH5-E6QCrJ3D8%3D)](https://cloudsmith.io/~orchardcore/repos/preview/packages/detail/nuget/OrchardCore.Application.Cms.Targets/latest/)
Expand Down
15 changes: 8 additions & 7 deletions src/OrchardCore.Build/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageManagement Include="MessagePack" Version="2.2.60" />
<PackageManagement Include="Microsoft.Extensions.Azure" Version="1.7.2" />
<PackageManagement Include="Microsoft.Extensions.Http.Resilience" Version="8.3.0" />
<PackageManagement Include="Microsoft.Identity.Web" Version="2.17.2" />
<PackageManagement Include="Microsoft.Identity.Web" Version="2.17.4" />
<PackageManagement Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageManagement Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageManagement Include="MimeKit" Version="4.4.0" />
Expand All @@ -52,12 +52,12 @@
<PackageManagement Include="NJsonSchema" Version="11.0.0" />
<PackageManagement Include="NLog.Web.AspNetCore" Version="5.3.8" />
<PackageManagement Include="NodaTime" Version="3.1.11" />
<PackageManagement Include="OpenIddict.Core" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Server.AspNetCore" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Server.DataProtection" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Validation.AspNetCore" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Validation.DataProtection" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Validation.SystemNetHttp" Version="5.3.0" />
<PackageManagement Include="OpenIddict.Core" Version="5.4.0" />
<PackageManagement Include="OpenIddict.Server.AspNetCore" Version="5.4.0" />
<PackageManagement Include="OpenIddict.Server.DataProtection" Version="5.4.0" />
<PackageManagement Include="OpenIddict.Validation.AspNetCore" Version="5.4.0" />
<PackageManagement Include="OpenIddict.Validation.DataProtection" Version="5.4.0" />
<PackageManagement Include="OpenIddict.Validation.SystemNetHttp" Version="5.4.0" />
<PackageManagement Include="OrchardCore.Translations.All" Version="1.8.0" />
<PackageManagement Include="PdfPig" Version="0.1.8" />
<PackageManagement Include="Serilog.AspNetCore" Version="8.0.1" />
Expand All @@ -66,6 +66,7 @@
<PackageManagement Include="StackExchange.Redis" Version="2.7.33" />
<PackageManagement Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageManagement Include="System.Linq.Async" Version="6.0.1" />
<PackageManagement Include="System.IO.Hashing" Version="8.0.0" />
<PackageManagement Include="xunit" Version="2.7.0" />
<PackageManagement Include="xunit.analyzers" Version="1.11.0" />
<PackageManagement Include="xunit.runner.visualstudio" Version="2.5.7" />
Expand Down
9 changes: 0 additions & 9 deletions src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ public override void ConfigureServices(IServiceCollection services)
return NilValue.Instance;
}));
o.MemberAccessStrategy.Register<Navbar, FluidValue>((navbar, name, context) =>
{
return name switch
{
nameof(Navbar.Properties) => new ObjectValue(navbar.Properties),
_ => NilValue.Instance
};
});
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
@using OrchardCore.Admin.Models
@using OrchardCore.DisplayManagement
@using OrchardCore.DisplayManagement.ModelBinding
@using OrchardCore.DisplayManagement.Zones

@inject IDisplayManager<Navbar> DisplayManager
@inject IUpdateModelAccessor UpdateModelAccessor

@if (Model.Content == null)
{
dynamic shape = await DisplayAsync(await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType));
var shape = await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType);

if (shape.Content == null)
if (!shape.TryGetProperty<IShape>("Content", out var content))
{
return;
}

Model.Content = shape.Content;
Model.Content = content;
}

<ul class="navbar-nav user-top-navbar">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ private async Task<AdminNodeListViewModel> BuildDisplayViewModel(Models.AdminMen
foreach (var factory in _factories)
{
var treeNode = factory.Create();
dynamic thumbnail = await _displayManager.BuildDisplayAsync(treeNode, _updateModelAccessor.ModelUpdater, "TreeThumbnail");
thumbnail.TreeNode = treeNode;
var thumbnail = await _displayManager.BuildDisplayAsync(treeNode, _updateModelAccessor.ModelUpdater, "TreeThumbnail");
thumbnail.Properties["TreeNode"] = treeNode;
thumbnails.Add(factory.Name, thumbnail);
}

Expand Down Expand Up @@ -138,8 +138,8 @@ public async Task<IActionResult> Create(AdminNodeEditViewModel model)
return NotFound();
}

dynamic editor = await _displayManager.UpdateEditorAsync(treeNode, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
editor.TreeNode = treeNode;
var editor = await _displayManager.UpdateEditorAsync(treeNode, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
editor.Properties["TreeNode"] = treeNode;

if (ModelState.IsValid)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@

@foreach (var child in children)
{
dynamic adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(child, updater, "TreeSummary");
adminNodeShape.AdminMenuId = Model.AdminMenuId;
adminNodeShape.MenuItem = child;
adminNodeShape.Index = Model.Index + "-" + index++;
var adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(child, updater, "TreeSummary");
adminNodeShape.Properties["AdminMenuId"] = Model.AdminMenuId;
adminNodeShape.Properties["MenuItem"] = child;
adminNodeShape.Properties["Index"] = Model.Index + "-" + index++;
@await DisplayAsync(adminNodeShape);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
{
if (menuItem != null)
{
dynamic adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(menuItem, updater, "TreeSummary");
adminNodeShape.AdminMenuId = Model.AdminMenu.Id;
adminNodeShape.MenuItem = menuItem;
adminNodeShape.Index = index++;
var adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(menuItem, updater, "TreeSummary");
adminNodeShape.Properties["AdminMenuId"] = Model.AdminMenu.Id;
adminNodeShape.Properties["MenuItem"] = menuItem;
adminNodeShape.Properties["Index"] = index++;

@await DisplayAsync(adminNodeShape)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static TField GetContentField<TField>(
ContentItem contentItem)
where TField : ContentField
{
if (((JsonObject)contentItem.Content)[fieldDefinition.PartDefinition.Name] is not JsonObject jPart ||
if (((JsonObject)contentItem.Content)[fieldDefinition.ContentTypePartDefinition.Name] is not JsonObject jPart ||
jPart[fieldDefinition.Name] is not JsonObject jField)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Boolean = pair.Field.Value,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
SelectedContentItemId = pair.ContentItemId,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Date = pair.Field.Value,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
DateTime = pair.Field.Value,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Html = pair.Field.Html,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Url = pair.Field.Url?[..Math.Min(pair.Field.Url.Length, LinkFieldIndex.MaxUrlSize)],
BigUrl = pair.Field.Url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Value = pair.Value?[..Math.Min(pair.Value.Length, MultiTextFieldIndex.MaxValueSize)],
BigValue = pair.Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Numeric = pair.Field.Value,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public override void Describe(DescribeContext<ContentItem> context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
ContentPart = pair.Definition.PartDefinition.Name,
ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Text = pair.Field.Text?[..Math.Min(pair.Field.Text.Length, TextFieldIndex.MaxTextSize)],
BigText = pair.Field.Text,
Expand Down
Loading

0 comments on commit 6ba53ac

Please sign in to comment.