-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f785efa
Showing
17 changed files
with
911 additions
and
0 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,17 @@ | ||
name: Error Annotation | ||
description: Error Annotation | ||
|
||
inputs: | ||
message: | ||
description: "Message to Display" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
var message = '${{ inputs.message }}'; | ||
message = message.replace(/(\r\n|\n|\r)/gm, ''); | ||
core.error(message); |
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,17 @@ | ||
name: Notice Annotation | ||
description: Notice Annotation | ||
|
||
inputs: | ||
message: | ||
description: "Message to Display" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
var message = '${{ inputs.message }}'; | ||
message = message.replace(/(\r\n|\n|\r)/gm, ''); | ||
core.notice(message); |
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,17 @@ | ||
name: Warning Annotation | ||
description: Warning Annotation | ||
|
||
inputs: | ||
message: | ||
description: "Message to Display" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
var message = '${{ inputs.message }}'; | ||
message = message.replace(/(\r\n|\n|\r)/gm, ''); | ||
core.warning(message); |
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,47 @@ | ||
name: Exit Code | ||
description: Exit Code | ||
|
||
inputs: | ||
code: | ||
description: "Exit Code Number (ensure it is unique across all workflows/actions)" | ||
required: true | ||
message: | ||
description: "Exit Message" | ||
required: false | ||
default: '' | ||
level: | ||
description: "Annotation Level (Error, Warning, Debug, Notice)" | ||
default: error | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: createMessage | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
result-encoding: string | ||
script: > | ||
return '[Exit Code: ${{ inputs.code }}] ${{ inputs.message }} | Note: Search for "code: ${{ inputs.code }}" in the .github/ directory to find the source of this error' | ||
- uses: ./.github/actions/tools/annotation/error | ||
if: inputs.level == 'error' | ||
with: | ||
message: ${{ steps.createMessage.outputs.result }} | ||
|
||
- uses: ./.github/actions/tools/annotation/warning | ||
if: inputs.level == 'warning' | ||
with: | ||
message: ${{ steps.createMessage.outputs.result }} | ||
|
||
- uses: ./.github/actions/tools/annotation/debug | ||
if: inputs.level == 'debug' | ||
with: | ||
message: ${{ steps.createMessage.outputs.result }} | ||
|
||
- uses: ./.github/actions/tools/annotation/notice | ||
if: inputs.level == 'notice' | ||
with: | ||
message: ${{ steps.createMessage.outputs.result }} | ||
|
||
- shell: cmd | ||
run: exit ${{ inputs.code }} |
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,20 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
commit-message: | ||
prefix: "(dependabot)" | ||
reviewers: | ||
- "${{ secrets.GHA_REVIEWER }}" | ||
schedule: | ||
interval: weekly | ||
|
||
- package-ecosystem: nuget | ||
directory: "/" | ||
commit-message: | ||
prefix: "(dependabot)" | ||
reviewers: | ||
- "${{ secrets.NUGET_REVIEWER }}" | ||
schedule: | ||
interval: weekly |
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,128 @@ | ||
name: Testing Matrix | ||
run-name: PR#${{ github.event.number }}${{ github.event.pull_request.draft && ' [DRAFT]' || '' }} - Continuous Testing (Matrix) - (${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }}) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
env: | ||
build_directory: Build | ||
test_project_suffix: Tests | ||
|
||
concurrency: | ||
group: Continuous-Testing-${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
buildAndRunTests: | ||
name: Continuous Testing | ||
permissions: write-all | ||
runs-on: windows-2022 | ||
if: ${{ !github.event.pull_request.draft }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
solution: [ Testing.sln ] | ||
|
||
steps: | ||
- name: Checkout [${{ github.event.pull_request.head.ref }}] | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} | ||
submodules: recursive | ||
|
||
#################################################################################################### | ||
### Initialize ### | ||
#################################################################################################### | ||
# Check for Changes in the Non-Ignored Files; If there are none, then Skip Tests | ||
# Skip: README, LICENSE, .gitignore, GitHub Workflows & Actions, etc. | ||
- name: Check for Changes to Determine if Tests can be Skipped | ||
id: getChanges | ||
uses: tj-actions/changed-files@v44.5.2 | ||
with: | ||
files_ignore: | | ||
README.md | ||
LICENSE | ||
.github/** | ||
.gitignore | ||
- name: Check if Tests can be Skipped | ||
id: getCanSkip | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
result-encoding: string | ||
script: | | ||
var changes = '${{ fromJSON(steps.getChanges.outputs.any_modified) }}' | ||
var skip = changes == 'false' | ||
console.log('Skip:', skip) | ||
return skip | ||
#################################################################################################### | ||
### Prepare to Run Tests ### | ||
#################################################################################################### | ||
- name: Setup MS-Build | ||
uses: microsoft/setup-msbuild@v2 | ||
if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} | ||
|
||
- name: Setup NuGet | ||
uses: NuGet/setup-nuget@v2.0.0 | ||
if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} | ||
|
||
- name: Restore Packages for ${{ matrix.solution }} | ||
shell: cmd | ||
if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} | ||
run: nuget restore "${{ matrix.solution }}" | ||
|
||
#################################################################################################### | ||
### Run Tests ### | ||
#################################################################################################### | ||
# Test 1 - Build Project | ||
- name: Build ${{ matrix.solution }} | ||
shell: cmd | ||
if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} | ||
run: msbuild "${{ matrix.solution }}" -t:rebuild -property:Configuration=Release -p:OutputPath=${{ env.build_directory }} | ||
|
||
- name: Error - Build Failed for ${{ matrix.solution }} | ||
if: failure() | ||
uses: ./.github/actions/tools/annotation/error | ||
with: | ||
message: '[Error] Build Failed for ${{ matrix.solution }}' | ||
|
||
# Test 2 - Run All Unit Tests within Project | ||
# Note: This Action Requires Windows | ||
- name: Run Tests for ${{ matrix.solution }} | ||
if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} | ||
uses: microsoft/vstest-action@v1.0.0 | ||
with: | ||
testAssembly: \*${{ env.test_project_suffix }}.dll | ||
searchFolder: .\*\${{ env.build_directory }}\ | ||
runInParallel: true | ||
ifNoFilesFound: ignore | ||
|
||
- name: Error - Tests Failed for ${{ matrix.solution }} | ||
if: failure() | ||
uses: ./.github/actions/tools/annotation/error | ||
with: | ||
message: '[Error] Tests Failed for ${{ matrix.solution }}' | ||
|
||
#################################################################################################### | ||
### Notify Success ### | ||
#################################################################################################### | ||
- name: Success - Successfully Built & Ran Tests for ${{ matrix.solution }} | ||
if: success() && !fromJSON(steps.getCanSkip.outputs.result) | ||
uses: ./.github/actions/tools/annotation/notice | ||
with: | ||
message: '[Success] Built & Ran Tests for ${{ matrix.solution }}' | ||
|
||
- name: Success - Skipped Tests for ${{ matrix.solution }} | ||
if: success() && fromJSON(steps.getCanSkip.outputs.result) | ||
uses: ./.github/actions/tools/annotation/notice | ||
with: | ||
message: '[Success] Skipped Tests for ${{ matrix.solution }}' |
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,80 @@ | ||
name: Push -> Tag | ||
run-name: Push [${{ github.ref_name }}] -> Tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: Versioning-${{ github.ref_name }} | ||
cancel-in-progress: false | ||
|
||
env: | ||
PROJECT_DIR_PATH: TJC.Singleton | ||
|
||
jobs: | ||
incrementPatch: | ||
name: Push [${{ github.event.head_commit.message }}] | ||
permissions: write-all | ||
runs-on: windows-2022 | ||
outputs: | ||
VersionNumber: ${{ steps.incrementVersion.outputs.result }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Check for Changes to See if Tagging can be Skipped | ||
id: getChanges | ||
uses: tj-actions/changed-files@v44.5.2 | ||
with: | ||
files: ${{ env.PROJECT_DIR_PATH }}/** | ||
|
||
- name: Get Last Version | ||
id: getLastVersion | ||
if: ${{ steps.getChanges.outputs.any_modified != 'false' }} | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
result-encoding: string | ||
script: | | ||
try { | ||
var latestTag = require("child_process").execSync("git describe --tags").toString().trim() | ||
console.log('Latest Tag:', latestTag) | ||
return latestTag | ||
} catch { | ||
return "" | ||
} | ||
- name: Get Next Version [${{ steps.getLastVersion.outputs.result }}] | ||
id: getNextVersion | ||
if: ${{ steps.getChanges.outputs.any_modified != 'false' }} | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
result-encoding: string | ||
script: | | ||
var latestTag = "${{ steps.getLastVersion.outputs.result }}" | ||
if (latestTag == "") | ||
return "v0.1.0" | ||
var ver = latestTag.replace("v","").split("-")[0] | ||
console.log('Last Version:', "v" + ver) | ||
var major = ver.split(".")[0] | ||
var minor = ver.split(".")[1] | ||
var patch = parseInt(ver.split(".")[2]) + 1 | ||
var next = "v" + major + "." + minor + "." + patch | ||
console.log('Next Version:', next) | ||
return next | ||
- name: Tag Version [${{ steps.getNextVersion.outputs.result }}] | ||
if: ${{ steps.getChanges.outputs.any_modified != 'false' }} | ||
run: | | ||
git tag ${{ steps.getNextVersion.outputs.result }} | ||
git push origin tag ${{ steps.getNextVersion.outputs.result }} | ||
- name: ${{ (steps.getChanges.outputs.any_modified == 'false') && 'Skipped Incrementing Version' || format('Incremented Version [{0}]', steps.getNextVersion.outputs.result) }} | ||
if: success() | ||
uses: ./.github/actions/tools/annotation/notice | ||
with: | ||
message: ${{ (steps.getChanges.outputs.any_modified == 'false') && 'Skipped Incrementing Version' || format('Incremented Version [{0}]', steps.getNextVersion.outputs.result) }} |
Oops, something went wrong.