forked from reactive-streams/reactive-streams-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modernize solution * Implement GA CI/CD
- Loading branch information
Showing
36 changed files
with
411 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "11:00" | ||
|
||
- package-ecosystem: nuget | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "11:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: pr_validation | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Test-${{matrix.os}} | ||
runs-on: ${{matrix.os}} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/[email protected] | ||
with: | ||
lfs: true | ||
fetch-depth: 0 | ||
|
||
- name: "Install .NET SDK" | ||
uses: actions/[email protected] | ||
with: | ||
global-json-file: "./global.json" | ||
|
||
- name: "Update release notes" | ||
shell: pwsh | ||
run: | | ||
./build.ps1 | ||
- name: "dotnet build" | ||
run: dotnet build -c Release | ||
|
||
# .NET Framework tests can't run reliably on Linux, so we only do .NET 6 | ||
|
||
- name: "dotnet test" | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | ||
dotnet test -c Release --framework net6.0 | ||
else | ||
dotnet test -c Release | ||
fi | ||
- name: "dotnet pack" | ||
run: dotnet pack -c Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Publish NuGet | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
publish-nuget: | ||
|
||
name: publish-nuget | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: "Update release notes" | ||
shell: pwsh | ||
run: | | ||
./build.ps1 | ||
- name: Create Packages | ||
run: dotnet pack /p:PackageVersion=${{ github.ref_name }} -c Release -o ./output | ||
|
||
- name: Push Packages | ||
run: dotnet nuget push "output/*.nupkg" -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json | ||
|
||
- name: release | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
with: | ||
draft: false | ||
prerelease: false | ||
release_name: 'Akka.Analyzers ${{ github.ref_name }}' | ||
tag_name: ${{ github.ref }} | ||
body_path: RELEASE_NOTES.md | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Upload Release Asset | ||
uses: AButler/[email protected] | ||
with: | ||
repo-token: ${{ github.token }} | ||
release-tag: ${{ github.ref_name }} | ||
files: 'output/*.nupkg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,12 @@ | ||
<# | ||
.SYNOPSIS | ||
This is a Powershell script to bootstrap a Fake build. | ||
.DESCRIPTION | ||
This Powershell script will download NuGet if missing, restore NuGet tools (including Fake) | ||
and execute your Fake build script with the parameters you provide. | ||
.PARAMETER Target | ||
The build script target to run. | ||
.PARAMETER Configuration | ||
The build configuration to use. | ||
.PARAMETER Verbosity | ||
Specifies the amount of information to be displayed. | ||
.PARAMETER WhatIf | ||
Performs a dry run of the build script. | ||
No tasks will be executed. | ||
.PARAMETER ScriptArgs | ||
Remaining arguments are added here. | ||
#> | ||
. "$PSScriptRoot\scripts\getReleaseNotes.ps1" | ||
. "$PSScriptRoot\scripts\bumpVersion.ps1" | ||
|
||
[CmdletBinding()] | ||
Param( | ||
[string]$Target = "Default", | ||
[ValidateSet("Release", "Debug")] | ||
[string]$Configuration = "Release", | ||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] | ||
[string]$Verbosity = "Verbose", | ||
[switch]$WhatIf, | ||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | ||
[string[]]$ScriptArgs | ||
) | ||
###################################################################### | ||
# Step 1: Grab release notes and update solution metadata | ||
###################################################################### | ||
$releaseNotes = Get-ReleaseNotes -MarkdownFile (Join-Path -Path $PSScriptRoot -ChildPath "RELEASE_NOTES.md") | ||
|
||
$FakeVersion = "4.57.4" | ||
$NUnitVersion = "3.6.0" | ||
$DotNetChannel = "preview"; | ||
$DotNetVersion = "1.0.0"; | ||
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1"; | ||
$NugetVersion = "4.1.0"; | ||
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe" | ||
# inject release notes into Directory.Buil | ||
UpdateVersionAndReleaseNotes -ReleaseNotesResult $releaseNotes -XmlFilePath (Join-Path -Path "$PSScriptRoot/src" -ChildPath "Directory.Generated.props") | ||
|
||
# Make sure tools folder exists | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
$ToolPath = Join-Path $PSScriptRoot "tools" | ||
if (!(Test-Path $ToolPath)) { | ||
Write-Verbose "Creating tools directory..." | ||
New-Item -Path $ToolPath -Type directory | out-null | ||
} | ||
|
||
########################################################################### | ||
# INSTALL .NET CORE CLI | ||
########################################################################### | ||
|
||
Function Remove-PathVariable([string]$VariableToRemove) | ||
{ | ||
$path = [Environment]::GetEnvironmentVariable("PATH", "User") | ||
if ($path -ne $null) | ||
{ | ||
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } | ||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User") | ||
} | ||
|
||
$path = [Environment]::GetEnvironmentVariable("PATH", "Process") | ||
if ($path -ne $null) | ||
{ | ||
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } | ||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process") | ||
} | ||
} | ||
|
||
# Get .NET Core CLI path if installed. | ||
$FoundDotNetCliVersion = $null; | ||
if (Get-Command dotnet -ErrorAction SilentlyContinue) { | ||
$FoundDotNetCliVersion = dotnet --version; | ||
} | ||
|
||
if($FoundDotNetCliVersion -ne $DotNetVersion) { | ||
$InstallPath = Join-Path $PSScriptRoot ".dotnet" | ||
if (!(Test-Path $InstallPath)) { | ||
mkdir -Force $InstallPath | Out-Null; | ||
} | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); | ||
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; | ||
|
||
Remove-PathVariable "$InstallPath" | ||
$env:PATH = "$InstallPath;$env:PATH" | ||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 | ||
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
} | ||
|
||
########################################################################### | ||
# INSTALL NUGET | ||
########################################################################### | ||
|
||
# Make sure nuget.exe exists. | ||
$NugetPath = Join-Path $ToolPath "nuget.exe" | ||
if (!(Test-Path $NugetPath)) { | ||
Write-Host "Downloading NuGet.exe..." | ||
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath); | ||
} | ||
|
||
########################################################################### | ||
# INSTALL FAKE | ||
########################################################################### | ||
# Make sure Fake has been installed. | ||
|
||
$FakeExePath = Join-Path $ToolPath "FAKE/tools/FAKE.exe" | ||
if (!(Test-Path $FakeExePath)) { | ||
Write-Host "Installing Fake..." | ||
Invoke-Expression "&`"$NugetPath`" install Fake -ExcludeVersion -Version $FakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null; | ||
if ($LASTEXITCODE -ne 0) { | ||
Throw "An error occured while restoring Fake from NuGet." | ||
} | ||
} | ||
|
||
########################################################################### | ||
# INSTALL NUnit3 Test Runner | ||
########################################################################### | ||
|
||
# Make sure NUnit3 Test Runner has been installed. | ||
$NUnitDllPath = Join-Path $ToolPath "NUnit.ConsoleRunner/tools/nunit3-console.exe" | ||
if (!(Test-Path $NUnitDllPath)) { | ||
Write-Host "Installing NUnit3 Runner..." | ||
Invoke-Expression "&`"$NugetPath`" install NUnit.ConsoleRunner -ExcludeVersion -Version $NUnitVersion -OutputDirectory `"$ToolPath`"" | Out-Null; | ||
if ($LASTEXITCODE -ne 0) { | ||
Throw "An error occured while restoring NUnit3 Test from NuGet." | ||
} | ||
} | ||
|
||
########################################################################### | ||
# RUN BUILD SCRIPT | ||
########################################################################### | ||
|
||
# Build the argument list. | ||
$Arguments = @{ | ||
target=$Target; | ||
configuration=$Configuration; | ||
verbosity=$Verbosity; | ||
dryrun=$WhatIf; | ||
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value }; | ||
|
||
# Start Fake | ||
Write-Host "Running build script..." | ||
Invoke-Expression "$FakeExePath `"build.fsx`" $ScriptArgs $Arguments" | ||
|
||
exit $LASTEXITCODE | ||
Write-Output "Added release notes $releaseNotes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function UpdateVersionAndReleaseNotes { | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
[PSCustomObject]$ReleaseNotesResult, | ||
|
||
[Parameter(Mandatory=$true)] | ||
[string]$XmlFilePath | ||
) | ||
|
||
# Load XML | ||
$xmlContent = New-Object XML | ||
$xmlContent.Load($XmlFilePath) | ||
|
||
# Update VersionPrefix and PackageReleaseNotes | ||
$versionPrefixElement = $xmlContent.SelectSingleNode("//VersionPrefix") | ||
$versionPrefixElement.InnerText = $ReleaseNotesResult.Version | ||
|
||
$packageReleaseNotesElement = $xmlContent.SelectSingleNode("//PackageReleaseNotes") | ||
$packageReleaseNotesElement.InnerText = $ReleaseNotesResult.ReleaseNotes | ||
|
||
# Save the updated XML | ||
$xmlContent.Save($XmlFilePath) | ||
} | ||
|
||
# Usage example: | ||
# $notes = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md" | ||
# $propsPath = Join-Path -Path (Get-Item $PSScriptRoot).Parent.FullName -ChildPath "Directory.Build.props" | ||
# UpdateVersionAndReleaseNotes -ReleaseNotesResult $notes -XmlFilePath $propsPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function Get-ReleaseNotes { | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
[string]$MarkdownFile | ||
) | ||
|
||
# Read markdown file content | ||
$content = Get-Content -Path $MarkdownFile -Raw | ||
|
||
# Split content based on headers | ||
$sections = $content -split "####" | ||
|
||
# Output object to store result | ||
$outputObject = [PSCustomObject]@{ | ||
Version = $null | ||
Date = $null | ||
ReleaseNotes = $null | ||
} | ||
|
||
# Check if we have at least 3 sections (1. Before the header, 2. Header, 3. Release notes) | ||
if ($sections.Count -ge 3) { | ||
$header = $sections[1].Trim() | ||
$releaseNotes = $sections[2].Trim() | ||
|
||
# Extract version and date from the header | ||
$headerParts = $header -split " ", 2 | ||
if ($headerParts.Count -eq 2) { | ||
$outputObject.Version = $headerParts[0] | ||
$outputObject.Date = $headerParts[1] | ||
} | ||
|
||
$outputObject.ReleaseNotes = $releaseNotes | ||
} | ||
|
||
# Return the output object | ||
return $outputObject | ||
} | ||
|
||
# Call function example: | ||
#$result = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md" | ||
#Write-Output "Version: $($result.Version)" | ||
#Write-Output "Date: $($result.Date)" | ||
#Write-Output "Release Notes:" | ||
#Write-Output $result.ReleaseNotes |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.