Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-welsh authored May 16, 2024
0 parents commit ec6ecaf
Show file tree
Hide file tree
Showing 20 changed files with 2,045 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# CODEOWNERS Generated [DATE]
#

* @wcenterprises/digital-is-superusers [CODE-OWNERS]

*.yml @wcenterprises/digital-is-build
/build/ @wcenterprises/digital-is-build
/.github/ @wcenterprises/digital-is-build
1 change: 1 addition & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: digital-is-jh-service-template CodeQL config
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/source" # Location of package manifests
schedule:
interval: "weekly"
day: "sunday"
open-pull-requests-limit: 0

# notify of updates to actions
- package-ecosystem: "github-actions"
directory: /
labels:
- dependabot
- actions
schedule:
interval: "weekly"
day: "sunday"
open-pull-requests-limit: 0

158 changes: 158 additions & 0 deletions .github/package-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: update-packages
#UTC Time, Central is 6 hours behind UTC, 24 hour time format.
on:
schedule:
- cron: "0 10,22 * * *"
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
type: choice
options:
- info
- warning
- debug

jobs:
update-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Package Updates
run: |
dotnet nuget add source `
--username "AutoUpdates" `
--password "${{ secrets.AZDO_NUGET_REPO }}" `
--store-password-in-clear-text `
--name IS-Nuget "https://pkgs.dev.azure.com/JackHenry/_packaging/IS-Nuget/nuget/v3/index.json"
git config --global user.email "[email protected]"
git config --global user.name "AutoUpdates"
# only update the nuget packages that start with 'Jha.'
Set-Variable -Name "PACKAGEIDSTARTSWITH" -Value "Jha." -Option Constant
# jira ticket
Set-Variable -Name "DEFAULTJIRATICKET" -Value "BSL-2921" -Option Constant
$JiraTicket = "${{ vars.PACKAGE_UPDATE_JIRA_TICKET }}"
if (-NOT $JiraTicket) {
$JiraTicket = $DefaultJiraTicket
}
# the name of the feature branch that is created.
Set-Variable -Name "FEATUREBRANCH" -Value "update-bot/package-updates" -Option Constant
$branchExists = git ls-remote --heads origin $featureBranch
Write-Host "Branch Exists: " $branchExists
# creates new branch.
function Add-NewBranch {
if ($branchExists) {
git checkout $featureBranch
}
else {
git checkout -b $featureBranch
}
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to create a new branch."
exit 1
}
}
# pushes the new branch.
function Push-NewBranch {
git add -A
git commit -m "Updating Jha.* Packages."
if ($branchExists) {
git push origin HEAD:$featureBranch
}
else {
git push -u origin $featureBranch
}
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to push new branch."
exit 1
}
}
# creates a pull request.
function Add-PullRequest {
$prState = gh pr view --json state | ConvertFrom-Json
Write-Host "PR State " $prState.state
if ($null -eq $prState -or $prState.state -eq "CLOSED" -or $prState.state -eq "MERGED" ) {
$body = "Description: Updating Jha.* Packages. `r`nJira-Tickets: $JiraTicket`r`n"
gh pr create --title "Jha.* Packages Updates (Bump)" --body $body
}
Write-Host "PR State " $prState.state
Write-Host "PR Data " $prState
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to create a pull request."
exit 1
}
}
# update with dotnet commands.
function Update-WithDotNet {
[CmdletBinding()]
param(
[Parameter(mandatory = $true)]
[string] $projectFileName,
[Parameter(mandatory = $true)]
[string] $packageName
)
dotnet add $projectFileName package $packageName
}
Write-Host "Updating project " $ProjectsToInclude.projects
# create new feature branch
Add-NewBranch
# get the cs proj files
$csProjFiles = Get-ChildItem -Path ${GITHUB_WORKSPACE} -Force -Recurse -Include "*.csproj"
Write-Host "CSProj Files: $csProjFiles"
# loop through the cs proj files
foreach ($childItem in $csProjFiles) {
[xml]$xmlElm = Get-Content -Path $childItem
$xmlElm.Project.ItemGroup.PackageReference | Where-Object {
$_.include -ne $null -and $_.include.StartsWith($PackageIdStartsWith)
} | ForEach-Object {
Write-Host "Updating reference " $_.include
Update-WithDotNet -projectFileName $childItem -packageName $_.include
}
}
if (-not (git status --porcelain)) {
Write-Host "Clean!"
Write-Host "All files up-to-date for" ${GITHUB_WORKSPACE}
}
else {
Write-Host "Not Clean!"
# commit branch
Write-Host "Commiting branch."
Push-NewBranch
# create PR
Write-Host "Creating pull request for branch $featureBranch."
Add-PullRequest
}
shell: pwsh
env:
GH_TOKEN: ${{ secrets.AUTOBOT_GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .github/pull-request-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull Request Validation
on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
validate-jira-issues:
runs-on: ubuntu-latest

steps:
- uses: wcenterprises/digital-is-build-actions/jira/[email protected]
with:
jira-token: ${{ secrets.JIRA_TOKEN }}
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
------------------------------------------
Instructions:
1. This template should be filled in for all pull requests.
2. Give an appropriate title and description.
3. Enter 1 or more comma-delimited JIRA issue IDs after Jira-Tickets
- e.g. Jira-Tickets: DSAND-101, DSAND-103
4. Review the checklist and check items you have completed. If items are not complete, keep them unchecked.
- You should provide information in the description for items that are unchecked.
- Do not remove checklist items. If a checklist item is not applicable, use the strikethrough notation.
- [ ] ~~I've added XML comments where necessary~~.
5. If items in the checklist are incomplete then you should complete those items prior to submitting the pull request.
6. Delete this instructions section prior to submitting the pull request.

_Note: use ![number] to link to PRs, #[number] to link to work items_

------------------------------------------
Description:

Jira-Tickets:

Checklist:
- [ ] I've reviewed the diff myself and ensured the changes are ready for review.
- [ ] I've run code cleanup to format my changes.
- [ ] I've added XML comments where necessary.
- [ ] I've validated that environment configurations have been applied to all environments.
- [ ] I've added or modified tests (unit and/or integration) to cover my changes and all tests are passing.
- [ ] I've validated that my changes do not add compiler warnings.
- [ ] I've built and ran locally to validate my changes.
- [ ] I've updated my work items to reflect the status of this change.
- [ ] I've added documentation to my work items that shows proof that I've validated the results.
- [ ] I've updated appropriate documentation (API spec, wiki, tech design, etc) for my changes.
- [ ] I've validated this change is covered by a feature flag. If a feature flag is not used, I've received approval to complete without.
- [ ] I'm ready to support this change going to Production.
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

on:
# Allow manual build
workflow_dispatch:

# Build on push to main
push:
branches:
- main
paths:
- '**/**'
- '!docs/**'
- '!build/**'
- '!azure-pipelines*'
- '!**/*.md'
- '!**/*.txt'
- '!**/unit-tests.yml'
- '!**/codeql.yml'

# Build every 6 months if not built already
schedule:
- cron: '0 1 1 */6 *'

jobs:
build-project:
name: Build Project
runs-on: windows-latest
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- uses: nuget/setup-nuget@v2
with:
nuget-version: 'latest'
nuget-api-key: ${{ secrets.AZDO_NUGET_REPO }}

- uses: wcenterprises/digital-is-build-actions/[email protected]
id: build-init
with:
package-name: '[PROJECT-NAME]'
azdo-token: '${{ secrets.AZDO_NUGET_REPO }}'
artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }}
artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: restore
run: |
dotnet restore '[SOLUTION-NAME]'
shell: pwsh

- name: build
run: |
write-output "##[group]build: [SOLUTION-NAME]"
dotnet build '[SOLUTION-NAME]' `
--no-restore `
--configuration release `
-p:Copyright="${{ steps.build-init.outputs.package-copyright }}" `
-p:Authors="${{ steps.build-init.outputs.package-authors }}" `
-p:Company="${{ steps.build-init.outputs.package-company }}" `
-p:AssemblyVersion="${{ steps.build-init.outputs.version-prefix }}" `
-p:FileVersion="${{ steps.build-init.outputs.version-prefix }}" `
-p:InformationalVersion="${{ steps.build-init.outputs.version-informational }}+${{ github.sha }}" `
-p:TrimUnusedDependencies=true `
-p:IsOnBuildAgent=true `
-p:CodeAnalysisTreatWarningsAsErrors=true `
-warnaserror `
-p:_SkipUpgradeNetAnalyzersNuGetWarning=true
write-output "##[endgroup]"
shell: pwsh
working-directory: '${{ github.workspace }}/source'

- name: publish
run: |
write-output "##[group]publish: [SOLUTION-NAME]"
dotnet publish [SOLUTION-NAME] `
--property:PublishDir="${{ steps.build-init.outputs.build-output-path }}" `
--configuration release `
--no-build `
--no-self-contained `
--no-restore `
--nologo `
-p:TrimUnusedDependencies=true `
-p:ErrorOnDuplicatePublishOutputFiles=false
write-output "##[endgroup]"
shell: pwsh
working-directory: '${{ github.workspace }}/source'

- uses: wcenterprises/digital-is-build-actions/[email protected]

- uses: wcenterprises/digital-is-build-actions/[email protected]

Loading

0 comments on commit ec6ecaf

Please sign in to comment.