Skip to content

Commit

Permalink
Merge branch 'dev' into openidRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
BenedekFarkas committed Nov 18, 2024
2 parents 39951db + 32e7d86 commit 17bd093
Show file tree
Hide file tree
Showing 1,978 changed files with 201,252 additions and 55,287 deletions.
33 changes: 32 additions & 1 deletion .deployment
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
; .deployment is actually an INI file and parsed by the following file
; https://raw.githubusercontent.com/projectkudu/kudu/master/Kudu.Core/Infrastructure/IniFile.cs

; Document of deployment with custom script
; https://github.com/projectkudu/kudu/wiki/Customizing-deployments#deploying-with-custom-script

; Document of configurable settings https://github.com/projectkudu/kudu/wiki/Configurable-settings
; Runtime settings cannot be overridden in .deployment e.g. WEBSITE_NODE_DEFAULT_VERSION
; More info https://github.com/projectkudu/kudu/wiki/Configurable-settings#runtime-settings

# Define default node version in WEBSITE_NODE_DEFAULT_VERSION APP Setting
# Find all Node.js versions from your AppService Kudu api/diagnostics/runtime
# More info https://codesanook-reactjs-server-side-rendering.scm.azurewebsites.net/api/diagnostics/runtime

; You can define a custom environment variable as
; CUSTOM_VARIABLE = my custom variable value
; and read in a deploy.ps1 script as
; $Env:CUSTOM_VARIABLE

; https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1#examples
[config]
command = deploy.cmd
COMMAND = PowerShell -NoProfile -NoLogo -ExecutionPolicy Unrestricted -Command "& "$(Join-Path -Path $(Get-Location) -ChildPath deploy.ps1)" 2>&1 | Write-Output"

; Set additional environment variables
; Timeout in seconds
; Set to one hour
SCM_COMMAND_IDLE_TIMEOUT = 3600

; Variables for MSBuild
MSBUILD_PATH = D:\Program Files (x86)\MSBuild-16.4\MSBuild\Current\Bin\MSBuild.exe
SOLUTION_PATH = src/Orchard.sln

; For Azure deployment, we use custom MS Build at root of the project.
PROJECT_PATH = Orchard.proj
30 changes: 30 additions & 0 deletions .github/workflows/build-crowdin-translation-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Crowdin Translation Packages

on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"

jobs:
build-crowdin-translation-packages:
defaults:
run:
shell: pwsh
runs-on: ubuntu-latest

steps:
- name: Orchard CMS
uses: andrii-bodnar/crowdin-request-action@aac9a865d62b37060b0ce530db5ac5cfca02dd2c # 0.0.2
with:
route: POST /projects/{projectId}/translations/builds
projectId: 46524
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}

- name: Orchard CMS Gallery
uses: andrii-bodnar/crowdin-request-action@aac9a865d62b37060b0ce530db5ac5cfca02dd2c # 0.0.2
with:
route: POST /projects/{projectId}/translations/builds
projectId: 63766
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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: pwsh
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/[email protected]

- name: Restore NuGet packages
run: nuget restore src/Orchard.sln

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Compile
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError

- name: Test
run: msbuild Orchard.proj /m /v:minimal /t:Test

compile-node:
name: Compile client-side assets
defaults:
run:
shell: pwsh
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/[email protected]

- name: Setup NodeJS
uses: actions/[email protected]
with:
node-version: '7'

- name: Setup NPM packages
working-directory: ./src
run: |
npm install --loglevel warn
# 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: Rebuild client-side assets
working-directory: ./src
run: |
gulp rebuild
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))
}
39 changes: 39 additions & 0 deletions .github/workflows/specflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: SpecFlow tests
# Compiles the solution and runs unit tests, as well the SpecFlow tests on the main development branches.

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Every day at midnight.

jobs:
compile:
name: SpecFlow tests
defaults:
run:
shell: pwsh
runs-on: windows-latest
strategy:
matrix:
branch: [dev, 1.10.x]

steps:
- name: Clone repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ matrix.branch }}

- 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:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError

- name: Test
run: msbuild Orchard.proj /m /v:minimal /t:Test

- name: Spec
run: msbuild Orchard.proj /m /v:minimal /t:Spec
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
**/.vs/**
src/Rebracer.xml

# User-specific files
*.suo
Expand Down Expand Up @@ -190,5 +192,3 @@ src/Orchard.Azure/Orchard.Azure.CloudService/Staging/

#enable all /lib artifacts
!lib/**/*.*
**/.vs/*
src/Rebracer.xml
12 changes: 6 additions & 6 deletions CREDITS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ License: Apache Software Foundation License 2.0

Lucene.net
-----
Website: http://incubator.apache.org/projects/lucene.net.html
Website: https://lucenenet.apache.org/
Copyright: Copyright (c) 2009 Apache Software Foundation
License: Apache Software Foundation License 2.0

MarkdownSharp
Markdig
-----
Website: http://code.google.com/p/markdownsharp/
Copyright: Copyright (c) 2009-2011 Jeff Atwood
License: MIT
Website: https://github.com/lunet-io/markdig
Copyright: Copyright (c) 2018-2019, Alexandre Mutel
License: BSD 2-Clause

Mono Class Library
-----
Expand Down Expand Up @@ -293,4 +293,4 @@ YUI
-----
Website: http://developer.yahoo.com/yui/
Copyright: Copyright (c) 2010, Yahoo! Inc.
License: New BSD
License: New BSD
34 changes: 34 additions & 0 deletions CalculateBindingRedirects.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[Reflection.Assembly]::LoadWithPartialName("System.Xml") | Out-Null
[Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq") | Out-Null
[System.Xml.Linq.XNamespace]$ns1 = "urn:schemas-microsoft-com:asm.v1"

$currentPath = (Get-Item -Path ".\").FullName
$orchardWebConfigFullPath = $currentPath+"\src\Orchard.Web\Web.Config"
[XML] $orchardWebConfig = Get-Content ($orchardWebConfigFullPath)
$configFiles = Get-ChildItem -Path ($currentPath +"\src\") -Filter web.config -Recurse -ErrorAction SilentlyContinue -Force
foreach ($configFile in $configFiles) {
$configFullPath = $configFile.FullName
Write-Host "Processing $configFullPath ..."

if ($configFullPath.ToLower().EndsWith("\orchard.web\web.config")) { #skip orchard.web config files
continue
}
[XML] $projectWebConfig = Get-Content ($configFullPath)
$elements = $projectWebConfig.configuration.runtime.assemblyBinding.dependentAssembly
foreach ($element in $elements){
Write-Host "Checking" $element.assemblyIdentity.name
$hasBinding = $orchardWebConfig.configuration.runtime.assemblyBinding.dependentAssembly.assemblyIdentity.Where({ $_.name -eq $element.assemblyIdentity.name -and $_.publicKeyToken -eq $element.assemblyIdentity.publicKeyToken -and $_.culture -eq $element.assemblyIdentity.culture }, 'First').Count -gt 0
if (-not $hasBinding){
# add the node in $webConfig
Write-Host "Adding" $element.assemblyIdentity.name
$newNode = $orchardWebConfig.ImportNode($element, $true);
$orchardWebConfig.configuration.runtime.assemblyBinding.AppendChild($newNode)
Write-Host "Added " $element.assemblyIdentity.name
} else {
Write-Host "Skipped" $element.assemblyIdentity.name
}
}
Write-Host "Processed $configFullPath ..."
}

$orchardWebConfig.Save($orchardWebConfigFullPath)
47 changes: 18 additions & 29 deletions ClickToBuild.cmd
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
FOR %%b in (
"%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
"%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
"%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

"%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
"%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

"%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
"%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
"%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
) do (
if exist %%b (
call %%b x86
goto build
)
)

FOR %%b in (
"%VS140COMNTOOLS%\vsvars32.bat"
"%VS120COMNTOOLS%\vsvars32.bat"
"%VS110COMNTOOLS%\vsvars32.bat"
) do (
if exist %%b (
call %%b
goto build
)
@echo off

REM Necessary for the InstallDir variable to work inside the MsBuild-finding loop below.
SETLOCAL ENABLEDELAYEDEXPANSION

for /f "usebackq tokens=1* delims=: " %%i in (`lib\vswhere\vswhere -latest -version "[16.0,18.0)" -requires Microsoft.Component.MSBuild`) do (
if /i "%%i"=="installationPath" (
set InstallDir=%%j
echo !InstallDir!
if exist "!InstallDir!\MSBuild\Current\Bin\MSBuild.exe" (
echo "Using MSBuild from !InstallDir!"
set msbuild="!InstallDir!\MSBuild\Current\Bin\MSBuild.exe"
goto build
)
)
)

echo "Unable to detect suitable environment. Build may not succeed."
Expand All @@ -42,6 +29,8 @@ IF "%solution%" == "" SET solution=src\Orchard.sln

lib\nuget\nuget.exe restore %solution%

msbuild /t:%target% %project% /p:Solution=%solution% /m
%msbuild% /t:%target% %project% /p:Solution=%solution% /m

:end

pause
83 changes: 83 additions & 0 deletions DeploymentUtility.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Set-StrictMode -Version Latest

# Continue a build process even though there is a warning wrote to std err.
# We will check exit code in Invoke-ExternalCommand to design whether it fail or not
$ErrorActionPreference = "Continue"

function Add-NpmToPathVariable {
$path = "$env:Appdata\npm"
$escapedPath = [Regex]::Escape($path)

# Remove existing npm path safe to add npm path again
$paths = $env:Path -split ';' | Where-Object {
$_ -notmatch "^$escapedPath\\?$"
}

# Update a path variable to this session
$env:Path = ($paths + $path) -join ";" # array + element item
}

function Invoke-ExternalCommand {
param (
[Parameter(Mandatory = $true)] [scriptblock] $ScriptBlock
)

# Displays an error message and continue executing if there is a standard error.
# This is because there are some external command tools write warning message to standard error.
# Use Write-Output also fix "Window title cannot be longer than 1023 characters" issue
# https://github.com/projectkudu/kudu/issues/2635
& $ScriptBlock 2>&1 | Write-Output

# If last exit code is not 0, throw an exception to stop a script
if ($LastExitCode) {
throw "Failed with exit code = $LastExitCode and command = $($ScriptBlock.ToString())"
}
}

function Write-EnviromentValue {
param (
[Parameter(Mandatory = $true)] [String[]] $EnvironmentName
)

"----------------- Begin of environment variables ---------------------------------"
Get-Item -Path Env:* | Where-Object {
$EnvironmentName -contains $_.Name
} | Format-Table Name, Value -Wrap

"----------------- End of environment variables ---------------------------------"
}

function Install-Yarn {
"Verify if yarn installed"
if (Get-Command -Name yarn -ErrorAction Ignore) {
"Updating yarn as a global tool to the latest version"
# https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd#parameters
# issue https://github.com/projectkudu/kudu/issues/2635
Invoke-ExternalCommand -ScriptBlock { npm update yarn -g }
}
else {
"Installing yarn as a global tool"
Invoke-ExternalCommand -ScriptBlock { npm install yarn -g }
Add-NpmToPathVariable
}
}

function Install-KuduSync {
"Verify if kudusync installed"
if (Get-Command -Name kudusync -ErrorAction Ignore) {
"Updating kudusync as a global tool to the latest version"
# https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd#parameters
# issue https://github.com/projectkudu/kudu/issues/2635
Invoke-ExternalCommand -ScriptBlock { npm update kudusync -g }
}
else {
"Installing kudusync as a global tool"
Invoke-ExternalCommand -ScriptBlock { npm install kudusync -g }
Add-NpmToPathVariable
}
}

Export-ModuleMember -Function Invoke-ExternalCommand
Export-ModuleMember -Function Write-EnviromentValue
Export-ModuleMember -Function Install-Yarn
Export-ModuleMember -Function Install-KuduSync
Loading

0 comments on commit 17bd093

Please sign in to comment.