From 7aec702bd2b43cf9d93636f7b3ed020cbac1992c Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Jul 2020 15:16:12 -0600 Subject: [PATCH 1/4] Adds Build actions --- .github/ISSUE_TEMPLATE/bug_report.md | 34 +++++++ .github/ISSUE_TEMPLATE/feature_request.md | 21 ++++ .github/scripts/GenerateVersionNumber.ps1 | 38 +++++++ .github/scripts/UpdateAssemblyVersion.ps1 | 40 ++++++++ .github/scripts/ZipBuildOutput.ps1 | 41 ++++++++ .github/workflows/docker.yml | 96 ++++++++++++++++++ .../PDT.PanasonicDisplay.EPI.suo | Bin 32256 -> 32256 bytes .../PDT.PanasonicDisplay.projectinfo | Bin 2017 -> 2013 bytes .../Properties/AssemblyInfo.cs | 13 ++- 9 files changed, 278 insertions(+), 5 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/scripts/GenerateVersionNumber.ps1 create mode 100644 .github/scripts/UpdateAssemblyVersion.ps1 create mode 100644 .github/scripts/ZipBuildOutput.ps1 create mode 100644 .github/workflows/docker.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..c969d2a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..0a854e7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 new file mode 100644 index 0000000..d05aecd --- /dev/null +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -0,0 +1,38 @@ +$latestVersions = $(git tag --merged origin/master) +$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\/master*.' { + $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1) + } + '^refs\/heads\/feature\/*.' { + $phase = 'alpha' + } + '^refs\/heads\/release\/*.' { + $phase = 'rc' + } + '^refs\/heads\/development*.' { + $phase = 'beta' + } + '^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 diff --git a/.github/scripts/UpdateAssemblyVersion.ps1 b/.github/scripts/UpdateAssemblyVersion.ps1 new file mode 100644 index 0000000..e52b31e --- /dev/null +++ b/.github/scripts/UpdateAssemblyVersion.ps1 @@ -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"; +} diff --git a/.github/scripts/ZipBuildOutput.ps1 b/.github/scripts/ZipBuildOutput.ps1 new file mode 100644 index 0000000..3f1998b --- /dev/null +++ b/.github/scripts/ZipBuildOutput.ps1 @@ -0,0 +1,41 @@ +# 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 "*.clz", "*.cpz", "*.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 + } +} +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 \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c44575b --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,96 @@ +name: Branch Build Using Docker + +on: + push: + branches: + - feature/* + - hotfix/* + - release/* + - main + - development + +env: + # solution path doesn't need slashes unless there it is multiple folders deep + # solution name does not include extension. .sln is assumed + SOLUTION_PATH: PDT.PanasonicDisplay.EPI + SOLUTION_FILE: PDT.PanasonicDisplay.EPI + # Do not edit this, we're just creating it here + VERSION: 0.0.0-buildtype-buildnumber + # Defaults to debug for build type + BUILD_TYPE: Debug + # Defaults to main as the release branch. Change as necessary + RELEASE_BRANCH: main +jobs: + Build_Project: + runs-on: windows-latest + steps: + # First we checkout the source repo + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + # And any submodules + - name: Checkout submodules + shell: bash + run: | + git config --global url."https://github.com/".insteadOf "git@github.com:" + auth_header="$(git config --local --get http.https://github.com/.extraheader)" + git submodule sync --recursive + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 + # Set the BUILD_TYPE environment variable + - name: Set Build to Release if triggered from main + run: | + if("$($Env:GITHUB_REF)".contains("$($Env:RELEASE_BRANCH)")) { + Write-Host "Setting build type to Release" + Write-Output "::set-env name=BUILD_TYPE::Release" + } + # Fetch all tags + - name: Fetch tags + run: git fetch --tags + # Generate the appropriate version number + - name: Set Version Number + shell: powershell + run: | + $version = ./.github/scripts/GenerateVersionNumber.ps1 + Write-Output "::set-env name=VERSION::$version" + # Use the version number to set the version of the assemblies + - name: Update AssemblyInfo.cs + shell: powershell + run: | + Write-Output ${{ env.VERSION }} + ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} + # Build the solutions in the docker image + - name: Build Solution + shell: powershell + run: | + Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_PATH)\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)" + # Zip up the output files as needed + - name: Zip Build Output + shell: powershell + run: ./.github/scripts/ZipBuildOutput.ps1 + - name: Upload Build Output + uses: actions/upload-artifact@v1 + with: + name: Build + path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + # Create the release on the source repo + - name: Create Release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + prerelease: ${{contains('debug', env.BUILD_TYPE)}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload the build package to the release + - name: Upload Release Package + id: upload_release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + asset_name: ${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + asset_content_type: application/zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.EPI.suo b/PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.EPI.suo index a0b689c098ca33c011e78c423012cabe9ab25f3b..a46c8f1d6305081e66a5e19abbef59973a0d56b0 100644 GIT binary patch delta 1074 zcmah{U1*bM6n@{=?@JS#wMk7(e-hKwbW>Z>pJg2jP5qiiT5C;p7HmbfG`32ttu^hs zRdjqC#S5=$9zg{iOucYSMEio^mC*`Lhv;s0vHAnffxGG0$c2hDo-Zv3BJ9BPz2|$+ zdCz&ykN%qLuleO(VRkXb7IL{9;=*mNq#p-CPKoE-G<~~mYABAB@;f^0waAzie4}=m zKO_eW0kOU{$P_7fpmqv8Mpc-}0$(Qy`0$Nu+#vR?5t@s2l9KTvv z1=&_CIm)cFQIyTFT`a_QvahMm6dPhms(BBqWCL=2sVdCHICY1uG|a>>ALp@KzVc4;niS<7 zWrLJ^oN^DcG2+rs-!amMS%U3jlX*_N*?vs>`e44 zaJD~=qpcGd-E;&;)}2q+{-RhZkx`h;)>=8z!IjWzG6>X{qUht}@?xNerz0tx_4MF$ z!vHUnynb^be}EfRXV4N3sz&!p@ngfEXby+C0`9qo(`%b~i)^i~;Ry6O<@ZM;WuD<+ho1-Wo8p635iHzCm(K_!IJVY>Enh_t V3)p1y@PrN8;BkDLEP{Sme*^qBG}{0G delta 956 zcmZ`$S!h#16rFjUq)8i1m&63q-KP|*HLW!+l=dZEEp6JWXe(7~P>WKF#E1(D5k&p) zqxOKPNEJ6kQEKK_a0gLbK2#J1{ZOcatsnU)MH27CD*EBTeed2g_uS=7^aqdr;3Hj{ zrHC=+CPS~5XK|2|NG6l=kT%NA#%0qdp9Nv@T4bnbLB02I=3?^B)h{xt0c9l zi%hlLlQjBJqM`exks~xqF-4gQQOiXf?YQr$K-}@%$`vPE($m71brU585=ZX(X1 zD1{Kwtg2jP*f+BU4?JGPXFkV$$D;J`48n%VIt_&8Mrb!PRoMi;I~U)*T?j9pgMqrCzjKD_9o7^1j5P&T)@=uGcxU#!SrX%# zOw_k%LMfdZBGS~ZSs6*m?7yM-@-~5ijv1N#Y!~ZeTiF2Hf}5dSTq<56Dk>LN;camN zz64#=B8^($cKHI?SUJfNXjqTo&Jap`^=fN5ST(|rcj{7K^`1+^XK2#sifS^t2~$&`b$K7ncNWjuyfU=uv50MJ=E5^IjmaQq40kQH@Cuty?}nCcA7|LOs}JtY iHVkhK;apJ$c0__0*_nmmJ{wN%?w23?6L!Q71b+e>nIRSc diff --git a/PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.projectinfo b/PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.projectinfo index 24a2e0cc44d24be7e32f8b6dde4619e8dc094ab1..354057df85ded7d95291acfafb7b9092d3dddf14 100644 GIT binary patch delta 650 zcmV;50(Jf258V%tg@0myo6>hLpS~Ht%$8YGEsN>XqFI&M_4xGV8ND)-ue;x#(pMMs z)!xqD&i2lO?Y+G>yZevs?>^eu9pB$SxcA_}-uBL?k9Kyb-JIH;JoIN-|xOb|M9Qnn@O?!eShDl`DA@D+<$63U6nr|3<^8ipSHif ztgD|UG|rai)w80^m)Ro!S-~^<%}P2isB=Q^tf8*jYm3_J>!!^YF9f3vb3;S8sI$e{ z>`ittJWVInVnqX-eYw2le3=)1R>|@{(|5X<kib=9W~a%WP8S&#Q|I zLd|}9QmwAvR0_|ka+cT4M~{pMlac{00$^UV!T~D+0m`%P1CauMuTT7+Md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DT.PanasonicDisplay.EPI/Properties/AssemblyInfo.cs +++ b/PDT.PanasonicDisplay.EPI/Properties/AssemblyInfo.cs @@ -1,8 +1,11 @@ using System.Reflection; +using Crestron.SimplSharp.Reflection; -[assembly: AssemblyTitle("EssentialsPluginTemplateEpi")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("EssentialsPluginTemplateEpi")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyVersion("1.0.0.*")] +[assembly: System.Reflection.AssemblyTitle("Panasonic Display Plugin")] +[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] +[assembly: System.Reflection.AssemblyProduct("Panasonic Display Plugin")] +[assembly: System.Reflection.AssemblyCopyright("Copyright © 2019")] +[assembly: System.Reflection.AssemblyVersion("1.0.1.*")] +[assembly: System.Reflection.AssemblyInformationalVersion("1.0.1.")] +[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("1.0.1.")] From 4920fe64f6a86aa308bfe0ec43f41b92af74e399 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Jul 2020 15:19:00 -0600 Subject: [PATCH 2/4] Updates script to use origin/main --- .github/scripts/GenerateVersionNumber.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index d05aecd..052d48a 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -1,4 +1,4 @@ -$latestVersions = $(git tag --merged origin/master) +$latestVersions = $(git tag --merged origin/main) $latestVersion = [version]"0.0.0" Foreach ($version in $latestVersions) { Write-Host $version @@ -17,7 +17,7 @@ $newVersion = [version]$latestVersion $phase = "" $newVersionString = "" switch -regex ($Env:GITHUB_REF) { - '^refs\/heads\/master*.' { + '^refs\/heads\/main*.' { $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1) } '^refs\/heads\/feature\/*.' { From 1f8555e0bf796ace701071df56dededcadb7b1b2 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Jul 2020 15:26:32 -0600 Subject: [PATCH 3/4] Adds docker login step --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c44575b..30af46d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,6 +59,12 @@ jobs: run: | Write-Output ${{ env.VERSION }} ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} + # Login to Docker + - name: Login to Docker + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} # Build the solutions in the docker image - name: Build Solution shell: powershell From 22460076eb9a178ace8a6b91737e874f3e5baee5 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Jul 2020 15:30:27 -0600 Subject: [PATCH 4/4] Updates creds to use org secrets --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 30af46d..4a17707 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -63,8 +63,8 @@ jobs: - name: Login to Docker uses: azure/docker-login@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} # Build the solutions in the docker image - name: Build Solution shell: powershell