Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: modernize project structure #1

Merged
merged 1 commit into from
Nov 14, 2024
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
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]-"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Stacktrace**

Include a stack trace of the exception if possible.
```
Paste stack trace here
```

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/essentials-plugin-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Essentials Plugin Request
about: Request an Essentials Plugin
title: "[REQUEST] - "
labels: plugin request
assignees: ''

---

** Describe the Plugin **
What do you want the plugin to do? Is it for a specific device? If it's for a specific device, include the manufacturer and model, along with links to API documentation if available.

** Does it need to be available in SIMPL Windows? **
If it does, describe the functionality that should be exposed to SIMPL Windows via EISC. This may include an example join map, or other way of documenting the layout of the EISC.

** Additional Features or functionality **
Describe additional features or functionality that this plugin should have.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]-"
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
If this is a request for support for a new device or type, be as specific as possible and include any pertinent manufacturer and model information.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
45 changes: 45 additions & 0 deletions .github/scripts/GenerateVersionNumber.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$latestVersions = $(git tag --merged origin/main)
$latestVersion = [version]"0.0.0"
Foreach ($version in $latestVersions) {
Write-Host $version
try {
if (([version]$version) -ge $latestVersion) {
$latestVersion = $version
Write-Host "Setting latest version to: $latestVersion"
}
}
catch {
Write-Host "Unable to convert $($version). Skipping"
continue;
}
}

$newVersion = [version]$latestVersion
$phase = ""
$newVersionString = ""
switch -regex ($Env:GITHUB_REF) {
'^refs\/heads\/main*.' {
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
}
'^refs\/heads\/feature\/*.' {
$phase = 'alpha'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/release\/*.' {
$splitRef = $Env:GITHUB_REF -split "/"
$version = [version]($splitRef[-1] -replace "v", "")
$phase = 'rc'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/dev*.' {
$phase = 'beta'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/hotfix\/*.' {
$phase = 'hotfix'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
}


Write-Output $newVersionString
40 changes: 40 additions & 0 deletions .github/scripts/UpdateAssemblyVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function Update-SourceVersion {
Param ([string]$Version)
#$fullVersion = $Version
$baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value
$NewAssemblyVersion = ‘AssemblyVersion("‘ + $baseVersion + ‘.*")’
Write-Output "AssemblyVersion = $NewAssemblyVersion"
$NewAssemblyInformationalVersion = ‘AssemblyInformationalVersion("‘ + $Version + ‘")’
Write-Output "AssemblyInformationalVersion = $NewAssemblyInformationalVersion"

foreach ($o in $input) {
Write-output $o.FullName
$TmpFile = $o.FullName + “.tmp”
get-content $o.FullName |
ForEach-Object {
$_ -replace ‘AssemblyVersion\(".*"\)’, $NewAssemblyVersion } |
ForEach-Object {
$_ -replace ‘AssemblyInformationalVersion\(".*"\)’, $NewAssemblyInformationalVersion
} > $TmpFile
move-item $TmpFile $o.FullName -force
}
}

function Update-AllAssemblyInfoFiles ( $version ) {
foreach ($file in “AssemblyInfo.cs”, “AssemblyInfo.vb” ) {
get-childitem -Path $Env:GITHUB_WORKSPACE -recurse | Where-Object { $_.Name -eq $file } | Update-SourceVersion $version ;
}
}

# validate arguments
$r = [System.Text.RegularExpressions.Regex]::Match($args[0], "\d+\.\d+\.\d+.*");
if ($r.Success) {
Write-Output "Updating Assembly Version to $args ...";
Update-AllAssemblyInfoFiles $args[0];
}
else {
Write-Output ” “;
Write-Output “Error: Input version does not match x.y.z format!”
Write-Output ” “;
Write-Output "Unable to apply version to AssemblyInfo.cs files";
}
42 changes: 42 additions & 0 deletions .github/scripts/ZipBuildOutput.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Uncomment these for local testing
# $Env:GITHUB_WORKSPACE = "C:\Working Directories\PD\essentials"
# $Env:SOLUTION_FILE = "PepperDashEssentials"
# $Env:VERSION = "0.0.0-buildType-test"

# Sets the root directory for the operation
$destination = "$($Env:GITHUB_HOME)\output"
New-Item -ItemType Directory -Force -Path ($destination)
Get-ChildItem ($destination)
$exclusions = @(git submodule foreach --quiet 'echo $name')
# Trying to get any .json schema files (not currently working)
# Gets any files with the listed extensions.
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.cplz" | ForEach-Object {
$allowed = $true;
# Exclude any files in submodules
foreach ($exclude in $exclusions) {
if ((Split-Path $_.FullName -Parent).contains("$($exclude)")) {
$allowed = $false;
break;
}
}
if ($allowed) {
Write-Host "allowing $($_)"
$_;
}
} | Copy-Item -Destination ($destination) -Force
Write-Host "Getting matching files..."
# Get any files from the output folder that match the following extensions
Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz"))} | ForEach-Object {
# Replace the extensions with dll and xml and create an array
$filenames = @($($_ -replace "cpz|clz|cplz", "dll"), $($_ -replace "cpz|clz|cplz", "xml"))
Write-Host "Filenames:"
Write-Host $filenames
if ($filenames.length -gt 0) {
# Attempt to get the files and return them to the output directory
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
}
}
Get-ChildItem -Path $destination\*.cplz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
Write-Host "Output Contents post Zip"
Get-ChildItem -Path $destination
22 changes: 22 additions & 0 deletions .github/workflows/essentialsplugins-betabuilds-caller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Beta Build

on:
push:
branches-ignore:
- "main"

workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
type: string

jobs:
call-workflow:
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-builds.yml@main
secrets: inherit
with:
branch: ${{ github.ref_name }}
default-branch: "main"

24 changes: 24 additions & 0 deletions .github/workflows/essentialsplugins-releasebuilds-caller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

name: Release Build

on:
release:
types:
- released
branches:
- "main"

workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
type: string

jobs:
call-workflow:
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-builds.yml@main
secrets: inherit
with:
branch: "main"
default-branch: "main"
2 changes: 2 additions & 0 deletions GetPackages.BAT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@Echo ON
nuget install .\packages.config -OutputDirectory .\packages -excludeVersion
3 changes: 3 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<packages>
<package id="PepperDashEssentials" version="1.16.1" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages>

This file was deleted.

Loading
Loading