Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- title: '🧰 Maintenance'
label: 'maintenance'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## Changes
$CHANGES
34 changes: 34 additions & 0 deletions .github/workflows/buildwindowsimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
release:
types: [published]

jobs:
build:
name: "Release"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: windows-2019

steps:
- uses: actions/checkout@v2.3.4

- name: Get the version
id: get_version
uses: battila7/get-version-action@v2

- name: Publish Images to Docker Hub - Pre Release
if: ${{ github.event.release.prerelease == true }}
run: |
docker build . --file EstateManagement/Dockerfilewindows --tag stuartferguson/estatereportingapi:dev
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatereportingapi:dev

- name: Publish Images to Docker Hub - Formal Release
if: ${{ github.event.release.prerelease == false }}
run: |
docker build . --file EstateManagement/Dockerfilewindows --tag stuartferguson/estatereportingapi:latest
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatereportingapi:latest
126 changes: 126 additions & 0 deletions .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Release

on:
release:
types: [published]

jobs:
build:
name: "Release"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Restore Nuget Packages
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

- name: Build Code
run: dotnet build EstateReportingAPI.sln --configuration Release

- name: Run Unit Tests
run: |
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj"

- name: Publish Images to Docker Hub - Pre Release
if: ${{ github.event.release.prerelease == true }}
run: |
docker build . --file EstateReportingAPI/Dockerfile --tag stuartferguson/estatereportingapi:dev
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatereportingapi:dev

- name: Publish Images to Docker Hub - Formal Release
if: ${{ github.event.release.prerelease == false }}
run: |
docker build . --file EstateReportingAPI/Dockerfile --tag stuartferguson/estatereportingapi:latest
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatereportingapi:latest

- name: Publish API
if: ${{ github.event.release.prerelease == false }}
run: dotnet publish "EstateReportingAPI\EstateReportingAPI.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained

- name: Install Octopus CLI
if: ${{ github.event.release.prerelease == false }}
run: |
sudo apt update && sudo apt install --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
curl -sSfL https://apt.octopus.com/public.key | sudo apt-key add - && \
sudo sh -c "echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list" && \
sudo apt update && sudo apt install octopuscli

- name: Pack Files for Octopus
if: ${{ github.event.release.prerelease == false }}
run: >-
octo pack
--outFolder /home/runner/work/EstateReportingAPI/EstateReportingAPI
--basePath /home/runner/work/EstateReportingAPI/EstateReportingAPI/publishOutput
--id EstateReportingAPI
--version ${{ steps.get_version.outputs.VERSION }}
--format zip
--verbose
--logLevel=verbose

- name: Push Package to Octopus
if: ${{ github.event.release.prerelease == false }}
run: >-
octo push
--server ${{ secrets.OCTOPUS_URL }}
--apiKey ${{ secrets.OCTOPUS_APIKEY }}
--package /home/runner/work/EstateReportingAPI/EstateReportingAPI/EstateReportingAPI.${{ steps.get_version.outputs.VERSION }}.zip
--overwrite-mode IgnoreIfExists

- name: Get Release
if: ${{ github.event.release.prerelease == false }}
id: getrelease
uses: octokit/request-action@v2.0.17
with:
route: GET /repos/TransactionProcessing/EstateReportingAPI/releases/tags/${{ steps.get_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Release Notes
if: ${{ github.event.release.prerelease == false }}
id: buildreleasenotes
uses: gr2m/get-json-paths-action@v1.x
with:
json: ${{ steps.getrelease.outputs.data }}
releasenote: "body"

- name: Create & Deploy Release in Octopus
if: ${{ github.event.release.prerelease == false }}
run: >-
octo create-release
--server ${{ secrets.OCTOPUS_URL }}
--apiKey ${{ secrets.OCTOPUS_APIKEY }}
--project "Estate Reporting API"
--version ${{ steps.get_version.outputs.VERSION }}
--channel Default
--deployTo Staging
--waitfordeployment
--deploymenttimeout 00:05:00
--releasenotes "${{ steps.buildreleasenotes.outputs.releasenote }}"

#- name: Build and Publish Nuget Packages
# if: ${{ github.event.release.prerelease == false }}
# run: |
# dotnet pack "EstateManagement.Client\EstateManagement.Client.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Client.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Estate.DomainEvents\EstateManagement.Estate.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Estate.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Merchant.DomainEvents\EstateManagement.Merchant.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Merchant.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Contract.DomainEvents\EstateManagement.Contract.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Contract.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.MerchantStatement.DomainEvents\EstateManagement.MerchantStatement.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.MerchantStatement.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Database\EstateManagement.Database.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Database.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}

86 changes: 86 additions & 0 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Nightly Build

on:
schedule:
- cron: "45 23 * * *"
repository_dispatch:

jobs:
check:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
commitcount: ${{ steps.commitswithintime.outputs.number-of-commits-within-time }}
steps:
- uses: actions/checkout@v2
#with:
#fetch-depth: 0

- name: Check for commits within time
#uses: AlexHolderDeveloper/CommitsWithinTime@v1.1.5
uses: TransactionProcessing/CommitsWithinTime@1.0.0
id: commitswithintime
with:
hours: 24

- name: Get the output from CommitsWithinTime
run: |
echo "The 'has-new-commits-within-time' value is ${{ steps.commitswithintime.outputs.has-new-commits-within-time }}"
echo "The 'number-of-commits-within-time' value is ${{ steps.commitswithintime.outputs.number-of-commits-within-time }}"
echo "The 'total-commits' value is ${{ steps.commitswithintime.outputs.total-commits }}"

build:
name: "Nightly Build"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-latest

needs: check
if: ${{ needs.check.outputs.commitcount > 0 }}

steps:
- uses: actions/checkout@v2.3.4

- name: Set Up Variables
run: echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV

- name: Restore Nuget Packages
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

- name: Build Code
run: dotnet build EstateReportingAPI.sln --configuration Release

- name: Run Unit Tests
run: |
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov1.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"

- name: Setup Node.js for use with actions
uses: actions/setup-node@v1.4.4

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./lcov1.info

- name: Build Docker Image
run: docker build . --file EstateReportingAPI/Dockerfile --tag estatereportingapi:latest

#- name: Run Integration Tests
#run: dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj"

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: tracelogs
path: /home/txnproc/trace/

- uses: dacbd/create-issue-action@main
if: ${{ failure() }}
name: Create an issue on build failure
with:
title: Investigate Nightly Build Failure
token: ${{secrets.GITHUB_TOKEN}}
labels: nightlybuild
body: Url is ${{env.action_url}}
40 changes: 40 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Test Pull Requests

on:
pull_request:
branches:
- main

jobs:
build:
name: "Build and Test Pull Requests"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4

- name: Restore Nuget Packages
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

- name: Build Code
run: dotnet build EstateReportingAPI.sln --configuration Release

- name: Run Unit Tests
run: |
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj"

- name: Build Docker Image
run: docker build . --file EstateReportingAPI/Dockerfile --tag estatereportingapi:latest

#- name: Run Integration Tests
#run: dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" --filter Category=PRTest

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: tracelogs
path: /home/txnproc/trace/
82 changes: 82 additions & 0 deletions .github/workflows/pushtomaster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Publish Pre-Release Nuget and Docker

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

jobs:
build:
name: "Publish Pre-Release Nugets and Docker"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Restore Nuget Packages
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

- name: Build Code
run: dotnet build EstateReportingAPI.sln --configuration Release

- name: 'Get Previous tag'
id: get-latest-tag
uses: actions-ecosystem/action-get-latest-tag@v1
with:
semver_only: true

- name: 'Bump Version'
id: bump-semver
uses: actions-ecosystem/action-bump-semver@v1
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch

- name: Print Version
id: next_version
run: echo ::set-output name=VERSION::${{ steps.bump-semver.outputs.new_version }}-build$GITHUB_RUN_NUMBER

#- name: Build and Publish Nuget Packages
# run: |
# dotnet pack "EstateManagement.Client\EstateManagement.Client.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Client.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Estate.DomainEvents\EstateManagement.Estate.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Estate.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Merchant.DomainEvents\EstateManagement.Merchant.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Merchant.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Contract.DomainEvents\EstateManagement.Contract.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Contract.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.MerchantStatement.DomainEvents\EstateManagement.MerchantStatement.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.MerchantStatement.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
# dotnet pack "EstateManagement.Database\EstateManagement.Database.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
# dotnet nuget push Nugets/EstateManagement.Database.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}

- name: Publish Images to Docker Hub
run: |
docker build . --file EstateReportingAPI/Dockerfile --tag stuartferguson/estatemanagement:master
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatemanagement:master

buildwidows:
name: "Publish Pre-Release Docker for Windows"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: windows-2019

steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Publish Windows Images to Docker Hub
run: |
docker build . --file EstateReportingAPI/Dockerfilewindows --tag stuartferguson/estatereportingapi:master
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/estatereportingapi:master
Loading