diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml new file mode 100644 index 00000000000..ca8bc847223 --- /dev/null +++ b/.github/workflows/main_ci.yml @@ -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 diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 961d8bf9b9a..fe25acb75b8 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -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 diff --git a/README.md b/README.md index a0f2367eb96..e8d7ca49416 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/src/OrchardCore.Build/Dependencies.props b/src/OrchardCore.Build/Dependencies.props index 87a0163d183..9bf4271ddf2 100644 --- a/src/OrchardCore.Build/Dependencies.props +++ b/src/OrchardCore.Build/Dependencies.props @@ -41,7 +41,7 @@ - + @@ -52,12 +52,12 @@ - - - - - - + + + + + + @@ -66,6 +66,7 @@ + diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs index fee003ba35f..c8357e3f5fe 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs @@ -120,15 +120,6 @@ public override void ConfigureServices(IServiceCollection services) return NilValue.Instance; })); - - o.MemberAccessStrategy.Register((navbar, name, context) => - { - return name switch - { - nameof(Navbar.Properties) => new ObjectValue(navbar.Properties), - _ => NilValue.Instance - }; - }); }); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml b/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml index 81684dd717b..88877f4c199 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml @@ -1,20 +1,21 @@ @using OrchardCore.Admin.Models @using OrchardCore.DisplayManagement @using OrchardCore.DisplayManagement.ModelBinding +@using OrchardCore.DisplayManagement.Zones @inject IDisplayManager 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("Content", out var content)) { return; } - Model.Content = shape.Content; + Model.Content = content; }