Skip to content

Commit

Permalink
GHA backport for release 6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
soujay authored Oct 7, 2021
1 parent a856cda commit 6551f3c
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI
on:
push:
branches:
- master
- release-[4-9].*
pull_request:
branches-ignore:
- release-[0-3].*
workflow_dispatch:
env:
DOTNET_NOLOGO: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2019
name: Windows
- os: ubuntu-20.04
name: Linux
fail-fast: false
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install SQL Server (Windows)
if: matrix.name == 'Windows'
shell: pwsh
run: |
choco install sql-server-express
# Set necessary SQLCMD environment variable for the setup step
echo "SQLCMDSERVER=.\SQLEXPRESS" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
# Set connection string as environment variable for the tests
echo "SqlServerTransportConnectionString=Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Start SQL Server (Linux)
if: matrix.name == 'Linux'
shell: bash
run: |
# If the password generator needs to be changed, make sure the resulting password meets SQL Server password requirements
sa_pw=$(uuidgen)
echo "::add-mask::$sa_pw"
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$sa_pw" -e "MSSQL_PID=Developer" -e "MSSQL_COLLATION=SQL_Latin1_General_CP1_CS_AS" -p 1433:1433 --name sqlserver -d mcr.microsoft.com/mssql/server:2017-latest
# Set necessary SQLCMD environment variable for the setup step
echo "SQLCMDPASSWORD=$sa_pw" >> $GITHUB_ENV
echo "SQLCMDUSER=sa" >> $GITHUB_ENV
echo "SQLCMDSERVER=localhost,1433" >> $GITHUB_ENV
# Set connection string as environment variable for the tests
echo "SqlServerTransportConnectionString=Server=localhost;Database=nservicebus;User Id=sa;Password=$sa_pw;" >> $GITHUB_ENV
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 5.0.x
- name: Setup .NET Core 3.1 runtime
uses: actions/[email protected]
with:
dotnet-version: 3.1.x
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
if: matrix.name == 'Windows'
uses: actions/[email protected]
with:
name: NuGet packages
path: nugets/
retention-days: 7
- name: Prepare SQL Server
shell: pwsh
run: |
# run this part later in the job to ensure the DB is up and running
echo "create databases"
sqlcmd -Q "CREATE DATABASE nservicebus"
sqlcmd -Q "CREATE DATABASE nservicebus1"
sqlcmd -Q "CREATE DATABASE nservicebus2"
echo "create additional schemas"
sqlcmd -Q "CREATE SCHEMA receiver AUTHORIZATION db_owner" -d "nservicebus"
sqlcmd -Q "CREATE SCHEMA sender AUTHORIZATION db_owner" -d "nservicebus"
sqlcmd -Q "CREATE SCHEMA db@ AUTHORIZATION db_owner" -d "nservicebus"
- name: Run tests
uses: Particular/[email protected]
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Release
on:
push:
tags:
- '[4-9].[0-9]+.[0-9]+'
- '[4-9].[0-9]+.[0-9]+-*'
env:
DOTNET_NOLOGO: true
jobs:
release:
runs-on: windows-2019 # Code signing requirement https://github.com/NuGet/Home/issues/7939
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Parse repo name
run: |
$FullName = "$env:GITHUB_REPOSITORY"
$Org,$RepoName = $FullName.Split('/')
echo "PARTICULAR_REPO_NAME=$RepoName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 5.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Install NuGetKeyVaultSignTool
run: dotnet tool install --global NuGetKeyVaultSignTool
- name: Sign NuGet Packages
run: |
NuGetKeyVaultSignTool sign nugets\*.nupkg `
--file-digest sha256 `
--timestamp-rfc3161 http://timestamp.digicert.com `
--timestamp-digest sha256 `
--azure-key-vault-url https://particularcodesigning.vault.azure.net `
--azure-key-vault-client-id ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} `
--azure-key-vault-tenant-id ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} `
--azure-key-vault-client-secret ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} `
--azure-key-vault-certificate ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }}
shell: pwsh
- name: Publish artifacts
uses: actions/[email protected]
with:
name: nugets
path: nugets/*
retention-days: 1
- name: Install Octopus CLI
uses: OctopusDeploy/[email protected]
with:
version: latest
- name: Create Octopus Package
run: |
# Creating the expected file layout for the Octopus package, including intermediate directories
mkdir -p packaging/content
# Octopus expects NuGet packages to have an extra .nzip extension for NuGet, .czip for Chocolatey
$nugets = Get-ChildItem -Path "./nugets/*.nupkg"
foreach ($file in $nugets) {
cp $file "./packaging/content/$($file.Name).nzip"
}
# Octopus Deploy scripts need an executable file to recreate this metadata
@"
`$Branch = "${{env.GitVersion_BranchName}}"
`$Version = "${{env.GitVersion_LegacySemVer}}"
`$Product = "${{env.PARTICULAR_REPO_NAME}}"
`$Major = "${{env.GitVersion_Major}}"
`$Minor = "${{env.GitVersion_Minor}}"
`$Commit = "${{env.GitVersion_Sha}}"
"@ > packaging/Metadata.ps1
# Create the Octopus package
octo pack --id="${{env.PARTICULAR_REPO_NAME}}.Deploy" --version="${{env.GitVersion_SemVer}}" --format="nupkg" --basePath="packaging" --outFolder="octopus-package"
shell: pwsh
- name: Publish Octopus Package Artifacts
uses: actions/[email protected]
with:
name: octopus-package
path: octopus-package/*
retention-days: 1
- name: Push package to Octopus Deploy
uses: OctopusDeploy/[email protected]
with:
server: https://deploy.particular.net
api_key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }}
packages: octopus-package/${{env.PARTICULAR_REPO_NAME}}.Deploy.${{env.GitVersion_SemVer}}.nupkg
- name: Create Octopus Deploy release
uses: OctopusDeploy/[email protected]
with:
server: https://deploy.particular.net
api_key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }}
project: ${{env.PARTICULAR_REPO_NAME}}
release_number: ${{env.GitVersion_SemVer}}
package_version: ${{env.GitVersion_SemVer}}
package: "GitReleaseManager:0.11.0"

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus" Version="7.4.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="7.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus" Version="7.4.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus" Version="7.4.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="7.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NServiceBus" Version="7.4.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down

0 comments on commit 6551f3c

Please sign in to comment.