Skip to content

Commit

Permalink
Merge pull request #26 from episerver/feature/Upgrade-Episerver-and-M…
Browse files Browse the repository at this point in the history
…ultitargeting

Update Episerver packages, target IndexingService to .NET 7
  • Loading branch information
Mark Hall authored Apr 12, 2023
2 parents 1ac26d7 + 556d1dd commit 3113173
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 59 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ jobs:
versionSuffix: ${{ github.ref == 'refs/heads/develop' && 'pre-' || 'ci-' }}${{github.RUN_NUMBER }}
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v1
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Restore
run: dotnet restore
- name: Build (Release version)
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet build --no-restore --configuration $env:buildConfiguration
run: dotnet build --no-restore --configuration $env:buildConfiguration
- name: Build (Pre-Release version)
if: ${{ github.ref != 'refs/heads/main' }}
run: dotnet build --no-restore --configuration $env:buildConfiguration --version-suffix $env:versionSuffix
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/ci-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
# - 'src/EPiServer.Search.IndexingService/**'
# - 'test/EPiServer.Search.IndexingService.Test/**'
# - 'docker-compose.yml'

jobs:
build_test_pack:
name: Build, test & push image
Expand All @@ -23,9 +23,11 @@ jobs:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v1
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Restore
run: dotnet restore
- name: Test
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,5 @@ EPiServer.Search.Cms.zip
sample/AlloyMvcTemplate/App_Data/**
sample/AlloyMvcTemplate/App_Code/**
/nupkgs
/modules
/modules
.idea
5 changes: 2 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<Import Project="build\version.props" />

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand Down
11 changes: 6 additions & 5 deletions build/dependencies.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project>
<PropertyGroup>
<CmsVersion>12.5.0</CmsVersion>
<CmsUiCoreVersion>[12.5.0,13)</CmsUiCoreVersion>
<CmsVersion>[12.17.1,13)</CmsVersion>
<CmsCoreVersion>[12.13.1,13)</CmsCoreVersion>
<CmsUiCoreVersion>[12.17.1,13)</CmsUiCoreVersion>
<Lucene>4.8.0-beta00015</Lucene>
</PropertyGroup>
<ItemGroup Condition = "'$(TargetFramework)' != 'net461'">
<PackageReference Update="EPiServer.CMS" Version="$(CmsVersion)" />
<PackageReference Update="EPiServer.Hosting" Version="$(CmsUiCoreVersion)" />
<PackageReference Update="EPiServer.Hosting" Version="$(CmsCoreVersion)" />
<PackageReference Update="EPiServer.CMS.UI.Core" Version="$(CmsUiCoreVersion)" />
<PackageReference Update="EPiServer.CMS.AspNetCore.Templating" Version="$(CmsUiCoreVersion)" />
<PackageReference Update="EPiServer.CMS.AspNetCore.HtmlHelpers" Version="$(CmsUiCoreVersion)" />
<PackageReference Update="EPiServer.CMS.AspNetCore.Templating" Version="$(CmsCoreVersion)" />
<PackageReference Update="EPiServer.CMS.AspNetCore.HtmlHelpers" Version="$(CmsCoreVersion)" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions build/version.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- This file may be overwritten by automation. Only values allowed here are VersionPrefix and VersionSuffix. -->
<Project>
<PropertyGroup>
<VersionPrefix>10.0.0</VersionPrefix>
<VersionPrefix>10.1.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
</PropertyGroup>
</Project>
</Project>
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ services:
search:
build:
dockerfile: ./src/EPiServer.Search.IndexingService/Search.Dockerfile
context: .
context: .
environment:
ASPNETCORE_URLS: http://*:80
ASPNETCORE_ENVIRONMENT: Production

ports:
- 5000:80
image: episerver.search.indexingservice:latest
container_name: EPiServer.Search.IndexingService
container_name: EPiServer.Search.IndexingService
volumes:
- shared-folder:/app/App_Data

volumes:
shared-folder:
shared-folder:
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "6.0.100",
"architecture": "x64",
"rollForward": "minor"
"version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
}
9 changes: 4 additions & 5 deletions sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<NoWarn>NU5100</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Wangkanai.Detection" Version="2.0.1" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="EPiServer.CMS" />
<PackageReference Include="EPiServer.Hosting" />
<PackageReference Include="EPiServer.CMS.AspNetCore.HtmlHelpers" />
Expand Down
1 change: 0 additions & 1 deletion src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<Import Project="$(BuildDirectory)public.props" />
<ItemGroup>
<None Remove="Resources\language.xml" />
</ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/EPiServer.Search.Cms/Job/IndexingJob.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.PlugIn;
using EPiServer.ServiceLocation;
Expand Down Expand Up @@ -31,7 +33,11 @@ public IndexingJob(IIndexingJobService indexingJobService)
/// <summary>
/// Executes the specified context.
/// </summary>
public override string Execute() => _indexingJobService.Start(OnStatusChanged);
public override string Execute()
{
using var contentCacheScope = new ContentCacheScope { SlidingExpiration = TimeSpan.Zero };
return _indexingJobService.Start(OnStatusChanged);
}

/// <summary>
/// Stops the indexing job.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00015"/>
<PackageReference Include="Lucene.Net.Analysis.Common" Version="4.8.0-beta00015"/>
<PackageReference Include="Lucene.Net.QueryParser" Version="4.8.0-beta00015"/>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="5.0.4" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageReference Include="Lucene.Net.Analysis.Common" Version="4.8.0-beta00016" />
<PackageReference Include="Lucene.Net.QueryParser" Version="4.8.0-beta00016" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/EPiServer.Search.IndexingService/Search.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 8000

FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
WORKDIR /src
COPY ["src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj", "EPiServer.Search.IndexingService/"]
RUN dotnet restore "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj"
Expand All @@ -11,7 +11,7 @@ COPY ["src/EPiServer.Search.IndexingService/", "EPiServer.Search.IndexingService
RUN dotnet build "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/publish
RUN dotnet publish "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/publish --framework net7.0

FROM base AS final
WORKDIR /app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void Dispose()
public void UpdateItem_WhenContentIsProvided_ShouldUseContentGuidAndLanguageAsId()
{
var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(),
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))));
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object);
_testSubject.ServiceActive = true;

var block = sharedBlockCreator.CreateSharedBlock(typeof(BlockData));
Expand All @@ -119,7 +119,7 @@ public void UpdateItem_WhenContentIsProvided_ShouldUseContentGuidAndLanguageAsId
public void UpdateItem_WhenContentIsProvided_ShouldUseNameAsTitle()
{
var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(),
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))));
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object);
_testSubject.ServiceActive = true;

var block = sharedBlockCreator.CreateSharedBlock(typeof(BlockData));
Expand Down Expand Up @@ -427,7 +427,7 @@ public void GetSearchResult_WhenQueryIsExecuted_ShouldUseSuppliedExpression()
public void GetSearchResult_WhenQueryIsExecuted_ContentQueryShouldBeAdded()
{
var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(),
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))));
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object);
var content = sharedBlockCreator.CreateSharedBlock(typeof(BlockData));
content.ContentLink = new ContentReference(1);
_contentRepositoryMock.Setup(r => r.Get<IContent>(It.IsAny<ContentReference>())).Returns(content);
Expand Down Expand Up @@ -456,7 +456,7 @@ public void GetSearchResult_WhenQueryIsExecuted_CurrentUserShouldBeAddedToAcl()
.Callback<AccessControlListQuery, IPrincipal, object>((q, p, o) => { q.AddUser(p.Identity.Name); });

var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(),
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))));
new ServiceLocation.ServiceAccessor<ContentDataInterceptor>(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object);
var content = sharedBlockCreator.CreateSharedBlock(typeof(BlockData));
content.ContentLink = new ContentReference(1);
_contentRepositoryMock.Setup(r => r.Get<IContent>(It.IsAny<ContentReference>())).Returns(content);
Expand Down
10 changes: 5 additions & 5 deletions test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="5.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 3113173

Please sign in to comment.