From 79b092b9c13e21df684f342708ef0f74bb72cd4e Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Wed, 2 Oct 2019 11:17:37 -0700 Subject: [PATCH 1/4] Add GitHub Actions build script and badge --- .github/workflows/msbuild-test.yml | 34 +++++++++++++++++++++++++++--- README.md | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/msbuild-test.yml b/.github/workflows/msbuild-test.yml index 3ed2d884..5763e4d4 100644 --- a/.github/workflows/msbuild-test.yml +++ b/.github/workflows/msbuild-test.yml @@ -7,7 +7,35 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@master - - uses: actions/setup-dotnet@v1 with: - dotnet-version: '4.5.1' - - run: dotnet build --configuration Release ./TShockAPI/TShockAPI.csproj + submodules: recursive + - name: Download MSBuild installer + run: powershell "$source = (New-Object System.Net.WebClient).DownloadString(\"https://gist.githubusercontent.com/sgkoishi/87e613881f9164bf03849603dd4f4266/raw/\") ; Add-Type + -TypeDefinition \"$source\" ; [SetupMSBuild]::Download((Get-Item -Path \".\\\").FullName); + " + - name: Setup .NET SDK + run: start /i /wait vs_BuildTools.exe --add "Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools" -p --wait --installPath "%cd%\VSBuildTools" --norestart --nocache + - name: OTAPI Debug + run: | + nuget.exe restore .\TerrariaServerAPI\TShock.4.OTAPI.sln + ".\VSBuildTools\MSBuild\Current\Bin\MSBuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug + cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug + TShock.Modifications.Bootstrapper.exe + - name: OTAPI Release + run: | + nuget.exe restore .\TerrariaServerAPI\TShock.4.OTAPI.sln + ".\VSBuildTools\MSBuild\Current\Bin\MSBuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release + cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release + TShock.Modifications.Bootstrapper.exe + - name: TerrariaServerAPI + run: | + cd .\TerrariaServerAPI + "..\VSBuildTools\MSBuild\Current\Bin\MSBuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release + - name: TShock + run: | + nuget.exe restore TShock.sln + ".\VSBuildTools\MSBuild\Current\Bin\MSBuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Release + - uses: actions/upload-artifact@master + with: + name: TShockRelease + path: TShockAPI\bin\Release diff --git a/README.md b/README.md index 5f5fda63..f6cd3f55 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

TShock for Terraria
- Build StatusAppVeyor Build StatusAll contributors
+ Build StatusAppVeyor Build StatusGitHub Actions Build StatusAll contributors

TShock is a toolbox for Terraria servers and communities. That toolbox is jam packed with anti-cheat tools, server-side characters, groups, permissions, item bans, tons of commands, and limitless potential. It's one of a kind. From fdbc958b3481680f3ca575e9c24fe4debb100597 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Wed, 2 Oct 2019 16:29:26 -0700 Subject: [PATCH 2/4] Include the download script --- .github/workflows/msbuild-test.yml | 2 +- scripts/SetupMSBuild.cs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 scripts/SetupMSBuild.cs diff --git a/.github/workflows/msbuild-test.yml b/.github/workflows/msbuild-test.yml index 5763e4d4..b2d259dd 100644 --- a/.github/workflows/msbuild-test.yml +++ b/.github/workflows/msbuild-test.yml @@ -10,7 +10,7 @@ jobs: with: submodules: recursive - name: Download MSBuild installer - run: powershell "$source = (New-Object System.Net.WebClient).DownloadString(\"https://gist.githubusercontent.com/sgkoishi/87e613881f9164bf03849603dd4f4266/raw/\") ; Add-Type + run: powershell "$source = Get-Content -Path \"scripts\\SetupMSBuild.cs\" ; Add-Type -TypeDefinition \"$source\" ; [SetupMSBuild]::Download((Get-Item -Path \".\\\").FullName); " - name: Setup .NET SDK diff --git a/scripts/SetupMSBuild.cs b/scripts/SetupMSBuild.cs new file mode 100644 index 00000000..89ce0588 --- /dev/null +++ b/scripts/SetupMSBuild.cs @@ -0,0 +1,22 @@ +using System; + +public class SetupMSBuild +{ + public static void Download(string directory) + { + try + { + var wc = new System.Net.WebClient(); + var content = wc.DownloadString("https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16"); + var url = System.Text.RegularExpressions.Regex.Match(content, + "https://download.visualstudio.microsoft.com/download/.*\\.exe").Value; + Console.WriteLine(url); + wc.DownloadFile(url, System.IO.Path.Combine(directory, "vs_BuildTools.exe")); + wc.DownloadFile("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", System.IO.Path.Combine(directory, "nuget.exe")); + } + catch (Exception e) + { + Console.WriteLine(e); + } + } +} \ No newline at end of file From 1915d69f081a65e67d9b7a357b8c6a8f9f796bff Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Wed, 2 Oct 2019 16:56:50 -0700 Subject: [PATCH 3/4] Rename the action to Build Server --- .github/workflows/{msbuild-test.yml => build.yml} | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{msbuild-test.yml => build.yml} (98%) diff --git a/.github/workflows/msbuild-test.yml b/.github/workflows/build.yml similarity index 98% rename from .github/workflows/msbuild-test.yml rename to .github/workflows/build.yml index b2d259dd..3070d2d6 100644 --- a/.github/workflows/msbuild-test.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: MSBuild Test +name: Build Server on: [push] diff --git a/README.md b/README.md index f6cd3f55..36963f28 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

TShock for Terraria
- Build StatusAppVeyor Build StatusGitHub Actions Build StatusAll contributors
+ Build StatusAppVeyor Build StatusGitHub Actions Build StatusAll contributors

TShock is a toolbox for Terraria servers and communities. That toolbox is jam packed with anti-cheat tools, server-side characters, groups, permissions, item bans, tons of commands, and limitless potential. It's one of a kind. From 8edea2c4d07782fd3e05bd90e4083f043cc98526 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Wed, 2 Oct 2019 16:58:08 -0700 Subject: [PATCH 4/4] Fix the space in url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36963f28..252320ee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

TShock for Terraria
- Build StatusAppVeyor Build StatusGitHub Actions Build StatusAll contributors
+ Build StatusAppVeyor Build StatusGitHub Actions Build StatusAll contributors

TShock is a toolbox for Terraria servers and communities. That toolbox is jam packed with anti-cheat tools, server-side characters, groups, permissions, item bans, tons of commands, and limitless potential. It's one of a kind.