Skip to content

Commit

Permalink
Merge pull request #507 from SSWConsulting/merge-api
Browse files Browse the repository at this point in the history
Consolidate .Admin, .Api and .Mobile
  • Loading branch information
tkapa authored Dec 18, 2023
2 parents 40a8425 + 7b34665 commit d0f4766
Show file tree
Hide file tree
Showing 691 changed files with 50,918 additions and 86 deletions.
38 changes: 38 additions & 0 deletions .azure/pipeline-admin-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
trigger:
branches:
include:
- master
paths:
include:
- "/Blazor/*"

pool:
vmImage: "ubuntu-latest"

variables:
system.debug: true
agent.diagnostic: true

stages:
- template: ./templates/build-ui-stage.yml
parameters:
WorkingDirectory: $(System.DefaultWorkingDirectory)/Blazor
BlazorProjectFile: SSW.Rewards.Admin.csproj
ArtifactName: adminUI
StageName: Build

- template: ./templates/deploy-ui-stage.yml
parameters:
EnvironmentName: Dev
AzureSubscriptionName: "SSW.Consulting.Dev"
DependsOnStageName: Build
ArtifactName: adminUI
SourcePath: "Blazor/wwwroot"

- template: ./templates/deploy-ui-stage.yml
parameters:
EnvironmentName: Prod
AzureSubscriptionName: "SSW.Consulting.Prod"
DependsOnStageName: Dev
ArtifactName: adminUI
SourcePath: "Blazor/wwwroot"
30 changes: 30 additions & 0 deletions .azure/templates/build-blazor-ui-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
parameters:
BuildId: "Unknown"
BuildConfiguration: Release
WorkingDirectory:
BlazorProjectFile:
ArtifactName:

steps:
- task: UseDotNet@2
displayName: Use Correct .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
workingDirectory: ${{parameters.WorkingDirectory}}

- task: DotNetCoreCLI@2
displayName: DotNET Publish ${{parameters.ArtifactName}}
inputs:
command: 'publish'
zipAfterPublish: false
projects: |
${{parameters.WorkingDirectory}}/${{parameters.BlazorProjectFile}}
arguments: --output ${{parameters.WorkingDirectory}}/published_ui --configuration ${{parameters.BuildConfiguration}}

- task: PublishBuildArtifacts@1
displayName: Publish Artifacts
inputs:
PathtoPublish: ${{parameters.WorkingDirectory}}/published_ui
ArtifactName: '${{parameters.ArtifactName}}'
publishLocation: 'Container'
17 changes: 17 additions & 0 deletions .azure/templates/build-ui-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
ArtifactName:
WorkingDirectory:
StageName:

stages:
- stage: ${{parameters.StageName}}
displayName: Build and Publish artifacts
jobs:
- job: BuildAndPublishBlazorUI
displayName: Build and Publish artifacts
steps:
- template: build-blazor-ui-tasks.yml
parameters:
ArtifactName: ${{parameters.ArtifactName}}
BuildId: $(Build.BuildId)
WorkingDirectory: ${{parameters.WorkingDirectory}}
48 changes: 48 additions & 0 deletions .azure/templates/deploy-ui-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
parameters:
AzureSubscriptionName:
EnvironmentName:
ArtifactName:
SourcePath:
DependsOnStageName:
ProjectName:

stages:
- stage: ${{parameters.EnvironmentName}}
dependsOn: ${{parameters.DependsOnStageName}}
displayName: Deploy ${{parameters.ProjectName}} to ${{parameters.EnvironmentName}}
# prevent deployment on PullRequest builds (Reason != PullRequest)
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: Deploy
environment: ${{parameters.EnvironmentName}}
pool:
vmImage: 'ubuntu-latest'
variables:
# Load the environment specific azure infrastructure variable groups
# e.g. Dev-infra, Staging-infra, Prod-infra
- group: ${{parameters.EnvironmentName}}-infra

# IMPORTANT: This is the naming convention for resource groups
# - e.g. SSW.Consulting.Dev, SSW.Consulting.Staging, SSW.Consulting.Prod
- name: resourceGroupName
value: SSW.Consulting.${{parameters.EnvironmentName}}

strategy:
runOnce:
deploy:
steps:
- template: deploy-ui-to-static-website-tasks.yml
parameters:
AzureSubscriptionName: ${{parameters.AzureSubscriptionName}}
ResourceGroupName: $(resourceGroupName)
StaticSiteAccountName: $(AdminStaticSiteAccountName)
StaticSiteAccountKey: $(AdminStaticSiteAccountKey)
ArtifactName: '$(Pipeline.Workspace)/${{parameters.ArtifactName}}'
SourcePath: ${{parameters.SourcePath}}

- template: purge-cdn.yml
parameters:
AzureSubscriptionName: ${{parameters.AzureSubscriptionName}}
ResourceGroupName: $(resourceGroupName)
CdnEndpointName: $(CdnEndpointName)
CdnProfileName: $(CdnProfileName)
34 changes: 34 additions & 0 deletions .azure/templates/deploy-ui-to-static-website-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
parameters:
AzureSubscriptionName:
ResourceGroupName:
StaticSiteAccountName:
StaticSiteAccountKey:
ArtifactName:
SourcePath:

steps:
- task: PowerShell@2
displayName: List Environment Variables
inputs:
targetType: 'inline'
pwsh: true
errorActionPreference: 'continue'
script: |
Get-ChildItem env:
- task: FileTransform@1
# replace any key-value pairs in the appsettings file with values from the available variable groups
displayName: Substitute values in appsettings
inputs:
folderPath: '${{parameters.ArtifactName}}/${{parameters.SourcePath}}'
fileType: 'json'
targetFiles: '**/appsettings.json'

- task: AzureCLI@2
displayName: Upload front-end to static web site in blog storage
inputs:
azureSubscription: '${{parameters.AzureSubscriptionName}}'
scriptType: pscore
scriptLocation: 'inlineScript'
inlineScript: |
az storage blob upload-batch --account-name ${{parameters.StaticSiteAccountName}} --account-key '${{parameters.StaticSiteAccountKey}}' -s '${{parameters.ArtifactName}}/${{parameters.SourcePath}}/' -d '$web' --overwrite true
15 changes: 15 additions & 0 deletions .azure/templates/purge-cdn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
AzureSubscriptionName:
ResourceGroupName:
CdnEndpointName:
CdnProfileName:

steps:
- task: AzureCLI@2
displayName: Purge CDN content
inputs:
azureSubscription: '${{parameters.AzureSubscriptionName}}'
scriptType: pscore
scriptLocation: 'inlineScript'
inlineScript: |
az cdn endpoint purge -g ${{parameters.ResourceGroupName}} -n ${{parameters.CdnEndpointName}} --profile-name ${{parameters.CdnProfileName}} --content-paths '/*' --no-wait
26 changes: 26 additions & 0 deletions .codeanalysis/codeanalysis.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="StyleCop and FxCop ruleset" Description="StyleCop and FxCop ruleset" ToolsVersion="15.0">
<IncludeAll Action="Error" />
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1600" Action="None" />
<!-- Partial classes must be documented - project wide we dont document at class level -->
<Rule Id="SA1601" Action="None" />
<Rule Id="SA1602" Action="None" />
<Rule Id="SA1633" Action="None" />
<Rule Id="SA0001" Action="None" />
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1413" Action="None" />
<Rule Id="SX1309" Action="Error" />
<Rule Id="SX1101" Action="Error" />
<!-- Do not directly await a task with configure await - this is irrelevant in .NET CORE -->
<Rule Id="CA2007" Action="None" />
<!-- Do not regions - OK to do so for making dividing code into logical sections. -->
<Rule Id="SA1124" Action="None" />
<!-- Static members should appear before non-static members - Alphabetical ordering is fine. -->
<Rule Id="SA1204" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.ApiDesignGuidelines.Analyzers" RuleNamespace="Microsoft.ApiDesignGuidelines.Analyzers">
</Rules>
</RuleSet>
9 changes: 9 additions & 0 deletions .codeanalysis/stylecop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Documentation for this file: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"indentation": {
"useTabs": false
}
}
}
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!build
136 changes: 136 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
repository:
# See https://docs.github.com/en/rest/reference/repos#update-a-repository for all available settings.

# The name of the repository. Changing this will rename the repository
name: SSW.Rewards.Mobile

# A short description of the repository that will show up on GitHub
description:

# A URL with more information about the repository
homepage: https://rewards.ssw.com.au

# A comma-separated list of topics to set on the repository
topics:

# Either `true` to make the repository private, or `false` to make it public.
private: false

# Either `true` to enable issues for this repository, `false` to disable them.
has_issues: true

# Either `true` to enable projects for this repository, or `false` to disable them.
# If projects are disabled for the organization, passing `true` will cause an API error.
has_projects: false

# Either `true` to enable the wiki for this repository, `false` to disable it.
has_wiki: false

# Either `true` to enable downloads for this repository, `false` to disable them.
has_downloads: false

# Updates the default branch for this repository.
default_branch: main

# Either `true` to allow squash-merging pull requests, or `false` to prevent
# squash-merging.
allow_squash_merge: true

# Either `true` to allow merging pull requests with a merge commit, or `false`
# to prevent merging pull requests with merge commits.
allow_merge_commit: false

# Either `true` to allow rebase-merging pull requests, or `false` to prevent
# rebase-merging.
allow_rebase_merge: true

# Either `true` to enable automatic deletion of branches on merge, or `false` to disable
delete_branch_on_merge: true

# Either `true` to enable automated security fixes, or `false` to disable
# automated security fixes.
enable_automated_security_fixes: true

# Either `true` to enable vulnerability alerts, or `false` to disable
# vulnerability alerts.
enable_vulnerability_alerts: true

# Labels: define labels for Issues and Pull Requests
labels:
- name: bug
color: CC0000
description: An issue with the system 🐛.

- name: feature
# If including a `#`, make sure to wrap it with quotes!
color: '#336699'
description: New functionality.

- name: Help Wanted
# Provide a new name to rename an existing label
new_name: first-timers-only

# Milestones: define milestones for Issues and Pull Requests
milestones:
# - title: milestone-title
# description: milestone-description
# # The state of the milestone. Either `open` or `closed`
# state: open

# Collaborators: give specific users access to this repository.
# See https://docs.github.com/en/rest/reference/repos#add-a-repository-collaborator for available options
collaborators:
# - username: bkeepers
# permission: push
# - username: hubot
# permission: pull

# Note: `permission` is only valid on organization-owned repositories.
# The permission to grant the collaborator. Can be one of:
# * `pull` - can pull, but not push to or administer this repository.
# * `push` - can pull and push, but not administer this repository.
# * `admin` - can pull, push and administer this repository.
# * `maintain` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
# * `triage` - Recommended for contributors who need to proactively manage issues and pull requests without write access.

# See https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions for available options
teams:
# - name: core
# permission: admin
# - name: docs
# permission: push

branches:
- name: main
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
# Branch Protection settings. Set to null to disable
protection:
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
required_pull_request_reviews:
# The number of approvals required. (1-6)
required_approving_review_count: 1
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: true
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
dismissal_restrictions:
users: []
teams: []
# Required. Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts:
- ci
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: true
# Prevent merge commits from being pushed to matching branches
required_linear_history: true
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
restrictions:
apps: []
users: []
teams: []
Loading

0 comments on commit d0f4766

Please sign in to comment.