Skip to content

Commit

Permalink
Initial Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-ivanlieckens committed Jul 31, 2024
1 parent 50e8de3 commit 03e41b4
Show file tree
Hide file tree
Showing 564 changed files with 46,477 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.{yml,yaml}]
indent_style = space
indent_size = 2
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug Report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Bug Report
description: File a bug report.
labels: ["bug"]
body:
- type: textarea
id: what-happened
attributes:
label: What happened?
value: |
Description
Reproduction Steps
1. Open
2. Execute
Actual Behavior
Expected Behavior
validations:
required: true

- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
options:
- label: I agree to follow this project's Code of Conduct
required: true

- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature Request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Feature Request
description: Request a new feature.
labels: ["enhancement"]
body:
- type: textarea
id: feature
attributes:
label: What would you add to the SDK?
validations:
required: true

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this feature, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
options:
- label: I agree to follow this project's Code of Conduct
required: true

- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/Question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Question
description: Ask any question about the project.
body:
- type: textarea
id: question
attributes:
label: What is your question?
validations:
required: true

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this question, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
options:
- label: I agree to follow this project's Code of Conduct
required: true
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Provide a general summary of your changes in the Title above -->
<!-- Apply the label "bug" or "enhacement" as applicable. -->

## Description / Motivation
<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->


## Testing

- [ ] The Unit & Intergration tests are passing.
- [ ] I have added the necesary tests to cover my changes.

## Terms
<!-- Place an X in the [] to check. -->

<!-- The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it. -->
- [ ] I agree to follow this project's [Code of Conduct](CODE_OF_CONDUCT.md).
86 changes: 86 additions & 0 deletions .github/workflows/Version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[CmdletBinding()]
Param (
[Parameter(HelpMessage = "Path to the file to append the version elements in.")]
[string]$Path,
[Parameter(HelpMessage = "Previous version to calculate the next version on. Must be like '1.0.0'.")]
[string]$PreviousVersion,
[Parameter(HelpMessage = "Commit Message")]
[string]$Message
)

function Get-Version
{
param (
[string]$PreviousVersion,
[string]$Message
)

$versionNumbers = $PreviousVersion -split "\."
$major = [int]$versionNumbers[0]
$minor = [int]$versionNumbers[1]
$patch = [int]$versionNumbers[2]

if ($Env:GITHUB_REF -like "refs/pull/*/feat/*" -or $Message -like "FEAT: *") {
$minor++
$patch = 0
} elseif ($Env:GITHUB_REF -like "refs/pull/*/new/*" -or $Message -like "NEW: *") {
$major++
$minor = 0
$patch = 0
} else {
$patch++
}

return "$major.$minor.$patch"
}

function Get-VersionSuffix
{
if ($Env:GITHUB_REF -like "refs/pull/*") {
$prId = $Env:GITHUB_REF -replace "refs/pull/(\d+)/.*", '$1'
$versionSuffix = "pr.$prId.$Env:GITHUB_RUN_NUMBER"
} else {
$versionSuffix = ""
}

return $versionSuffix
}

function Set-Version
{
param (
[string]$Path,
[string]$Version,
[string]$Suffix
)

$xml = [xml](Get-Content -Path $Path)
$properties = $xml.Project.PropertyGroup

$assemblyVersionElement = $xml.CreateElement("AssemblyVersion")
$assemblyVersionElement.InnerText = "$Version.$Env:GITHUB_RUN_NUMBER"

$versionElement = $xml.CreateElement("VersionPrefix")
$versionElement.InnerText = $Version

$fileVersionElement = $xml.CreateElement("FileVersion")
$fileVersionElement.InnerText = "$Version.$Env:GITHUB_SHA"

if (![string]::IsNullOrEmpty($Suffix)) {
$suffixElement = $xml.CreateElement("VersionSuffix")
$suffixElement.InnerText = $Suffix
$properties.AppendChild($suffixElement)
}

$properties.AppendChild($assemblyVersionElement)
$properties.AppendChild($versionElement)
$properties.AppendChild($fileVersionElement)

$xml.Save($Path)
}

$newVersion = Get-Version $PreviousVersion $Message
$suffix = Get-VersionSuffix
Set-Version $Path $newVersion $suffix | Out-Null

return "newVersion=$newVersion"
114 changes: 114 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build

on:
workflow_call:
inputs:
buildConfiguration:
type: string
required: true
description: 'The build configuration to use'
default: 'Release'
outputs:
newVersion:
description: 'The new version number'
value: ${{ jobs.build.outputs.newVersion }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
newVersion: ${{ steps.version.outputs.newVersion }}

steps:
- uses: actions/checkout@v4

- name: Get Version Info
uses: actions/github-script@v7
id: get-version-info
with:
script: |
async function getLatestRelease() {
try {
const response = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
core.info('Previous Release Version = ' + response.data.tag_name);
core.setOutput('previousVersion', response.data.tag_name);
} catch (error) {
if (error.status === 404) {
core.info('No releases found for this repository.');
core.setOutput('previousVersion', '0.0.0');
} else {
console.error('An error occurred while fetching the latest release: ', error);
throw error;
}
}
}
async function getCommitMessage() {
try {
const response = await github.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.sha
});
core.info('Commit Message = ' + response.data.commit.message);
core.setOutput('commitMessage', response.data.commit.message);
} catch (error) {
console.error('An error occurred while fetching the commit message: ', error);
throw error;
}
}
await getLatestRelease();
await getCommitMessage();
- name: Version
id: version
shell: pwsh
run: |
$message = @"
${{ steps.get-version-info.outputs.commitMessage }}
"@
./.github/workflows/Version.ps1 -Path "./src/Directory.Build.props" -PreviousVersion ${{ steps.get-version-info.outputs.previousVersion }} -Message $message >> $Env:GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build -c ${{ inputs.buildConfiguration }} --no-restore

- name: Test
run: dotnet test -c ${{ inputs.buildConfiguration }} --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage" --results-directory TestResults

- name: Upload dotnet test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: TestResults
if: ${{ always() }}

- name: Run Benchmarks
working-directory: ./tests/Sitecore.AspNetCore.SDK.RenderingEngine.Benchmarks
run: dotnet run -c Release

- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: perf-results
path: ./tests/Sitecore.AspNetCore.SDK.RenderingEngine.Benchmarks/BenchmarkDotNet.Artifacts

- name: Package
run: dotnet pack -c ${{ inputs.buildConfiguration }} --no-build --output nupkgs

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages
path: nupkgs
Loading

0 comments on commit 03e41b4

Please sign in to comment.