+++ /dev/null
-name: Deploy
-
-on:
- push:
- tags:
- - 'v*'
-
-jobs:
- build:
- name: Build
- runs-on: windows-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- with:
- submodules: true
- - name: Setup MSBuild.exe
- uses: microsoft/setup-msbuild@v1.0.1
- - name: Setup .NET Core
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 5.0.100-rc.1.20452.10
- - name: Install dependencies
- run: dotnet restore ./src
- # - name: Build Impostor.Client
- # run: msbuild ./src/Impostor.Client/Impostor.Client.csproj /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None
- - name: Build Impostor.Server
- run: dotnet build --no-restore -c Release -f net5.0 ./src/Impostor.Server/Impostor.Server.csproj
- - name: Test
- run: dotnet test --no-restore -v normal -f net5.0 ./src
- # - name: Zip Impostor.Client
- # shell: bash
- # run: |
- # cd ./src/Impostor.Client/bin/Release/net452/win-x64
- # 7z a -r $GITHUB_WORKSPACE/build/win-x64-client.zip *
- # cd $GITHUB_WORKSPACE
- -
- name: Publish Impostor.Server (win-x64)
- run: dotnet publish -c release -o ./build/win-x64 -f net5.0 -r win-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - name: Zip Impostor.Server (win-x64)
- shell: bash
- run: |
- cd ./build/win-x64
- 7z a -r ../win-x64.zip *
- cd $GITHUB_WORKSPACE
- -
- name: Publish Impostor.Server (linux-x64)
- run: dotnet publish -c release -o ./build/linux-x64 -f net5.0 -r linux-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - name: Zip Impostor.Server (linux-x64)
- shell: bash
- run: |
- cd ./build/linux-x64
- 7z a -r ../linux-x64.zip *
- cd $GITHUB_WORKSPACE
- -
- name: Publish Impostor.Server (linux-arm)
- run: dotnet publish -c release -o ./build/linux-arm -f net5.0 -r linux-arm --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - name: Zip Impostor.Server (linux-arm)
- shell: bash
- run: |
- cd ./build/linux-arm
- 7z a -r ../linux-arm.zip *
- cd $GITHUB_WORKSPACE
- -
- name: Publish Impostor.Server (linux-arm64)
- run: dotnet publish -c release -o ./build/linux-arm64 -f net5.0 -r linux-arm64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - name: Zip Impostor.Server (linux-arm64)
- shell: bash
- run: |
- cd ./build/linux-arm64
- 7z a -r ../linux-arm64.zip *
- cd $GITHUB_WORKSPACE
- -
- name: Publish Impostor.Server (osx-x64)
- run: dotnet publish -c release -o ./build/osx-x64 -f net5.0 -r osx-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - name: Zip Impostor.Server (osx-x64)
- shell: bash
- run: |
- cd ./build/osx-x64
- 7z a -r ../osx-x64.zip *
- cd $GITHUB_WORKSPACE
- -
- name: Create Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ github.ref }}
- release_name: Release ${{ github.ref }}
- body: |
- Changes in this Release
- - First Change
- - Second Change
- draft: true
- prerelease: false
- # -
- # name: Upload Release Asset (win-x64) Client
- # uses: actions/upload-release-asset@v1
- # env:
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # with:
- # upload_url: ${{ steps.create_release.outputs.upload_url }}
- # asset_path: ./build/win-x64-client.zip
- # asset_name: Impostor-Client-win-x64.zip
- # asset_content_type: application/zip
- -
- name: Upload Release Asset (win-x64) Server
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build/win-x64.zip
- asset_name: Impostor-Server-win-x64.zip
- asset_content_type: application/zip
- -
- name: Upload Release Asset (linux-x64) Server
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build/linux-x64.zip
- asset_name: Impostor-Server-linux-x64.zip
- asset_content_type: application/zip
- -
- name: Upload Release Asset (linux-arm) Server
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build/linux-arm.zip
- asset_name: Impostor-Server-linux-arm.zip
- asset_content_type: application/zip
- -
- name: Upload Release Asset (linux-arm64) Server
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build/linux-arm64.zip
- asset_name: Impostor-Server-linux-arm64.zip
- asset_content_type: application/zip
- -
- name: Upload Release Asset (osx-x64) Server
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build/osx-x64.zip
- asset_name: Impostor-Server-osx-x64.zip
- asset_content_type: application/zip
\ No newline at end of file
install:
- git submodule update --init --recursive
-
-before_build:
- - dotnet restore "src/Impostor.sln" -v Minimal
+ - ps: .\build\dotnet-install.ps1 -InstallDir 'C:\Program Files\dotnet\'
+ - ps: dotnet tool restore
build_script:
- # Tests
- - dotnet build "src/Impostor.Tests/Impostor.Tests.csproj" -c Release
- # Client
- - dotnet build "src/Impostor.Client/Impostor.Client.Cli/Impostor.Client.Cli.csproj" --no-restore -c Release -f net5.0
- - dotnet build "src/Impostor.Client/Impostor.Client.WinForms/Impostor.Client.WinForms.csproj" /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None
- # Server win-x64
- - dotnet publish -c release -o build/win-x64 -f net5.0 -r win-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - ps: 7z a -r build/Impostor-Server-win-x64-$(APPVEYOR_BUILD_VERSION).zip %APPVEYOR_BUILD_FOLDER%/build/win-x64/*
- # Server linux-x64
- - dotnet publish -c release -o ./build/linux-x64 -f net5.0 -r linux-x64 --self-contained --no-restore ./src/Impostor.Server/Impostor.Server.csproj /p:PublishSingleFile=true
- - ps: z a -r build/Impostor-Server-linux-x64-$(APPVEYOR_BUILD_VERSION).zip %APPVEYOR_BUILD_FOLDER%/build/linux-x64/*
-
-test_script:
- - dotnet test --no-build --no-restore -v normal -f net5.0 -c Release "src/Impostor.Tests"
+ - ps: dotnet cake build.cake --bootstrap
+ - ps: dotnet cake build.cake --pack
+
+test: off
artifacts:
- - path: build/Impostor-Server-win-x64-$(APPVEYOR_BUILD_VERSION).zip
- name: Impostor-Server-win-x64-$(APPVEYOR_BUILD_VERSION).zip
- - path: build/Impostor-Server-linux-x64-$(APPVEYOR_BUILD_VERSION).zip
- name: Impostor-Server-linux-x64-$(APPVEYOR_BUILD_VERSION).zip
+ - path: ./build/*.zip
only_commits:
files:
- - appveyor.yml
- - src/**/*
+ - ./appveyor.yml
+ - ./build.cake
+ - ./src/**/*
- .gitmodules
--- /dev/null
+var buildVersion = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "1.0.0";
+var buildDir = MakeAbsolute(Directory("./build"));
+
+var target = Argument("target", "Deploy");
+var configuration = Argument("configuration", "Release");
+
+//////////////////////////////////////////////////////////////////////
+// UTILS
+//////////////////////////////////////////////////////////////////////
+
+public void ImpostorPublish(string name, string project, string runtime) {
+ var projBuildDir = buildDir.Combine(name + "-" + runtime);
+ var projBuildZip = buildDir.CombineWithFilePath(name + "-" + buildVersion + "-" + runtime + ".zip");
+
+ DotNetCorePublish(project, new DotNetCorePublishSettings {
+ Configuration = configuration,
+ NoRestore = true,
+ Framework = "net5.0",
+ Runtime = runtime,
+ SelfContained = true,
+ PublishSingleFile = true,
+ PublishTrimmed = true,
+ OutputDirectory = projBuildDir
+ });
+
+ Zip(projBuildDir, projBuildZip);
+}
+
+public void ImpostorPublishNF(string name, string project) {
+ var runtime = "win-x64";
+ var projBuildDir = buildDir.Combine(name + "-" + runtime);
+ var projBuildZip = buildDir.CombineWithFilePath(name + "-" + buildVersion + "-" + runtime + ".zip");
+
+ DotNetCorePublish(project, new DotNetCorePublishSettings {
+ Configuration = configuration,
+ NoRestore = true,
+ Framework = "net462",
+ OutputDirectory = projBuildDir
+ });
+
+ Zip(projBuildDir, projBuildZip);
+}
+
+//////////////////////////////////////////////////////////////////////
+// TASKS
+//////////////////////////////////////////////////////////////////////
+
+Task("Clean")
+ .Does(() => {
+ if (DirectoryExists(buildDir)) {
+ DeleteDirectory(buildDir, new DeleteDirectorySettings {
+ Recursive = true
+ });
+ }
+ });
+
+Task("Restore")
+ .Does(() => {
+ DotNetCoreRestore("./src/Impostor.sln");
+ });
+
+Task("Build")
+ .IsDependentOn("Clean")
+ .IsDependentOn("Restore")
+ .Does(() => {
+ // Tests.
+ DotNetCoreBuild("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreBuildSettings {
+ Configuration = configuration,
+ });
+
+ // Client.
+ ImpostorPublishNF("Impostor-Client", "./src/Impostor.Client/Impostor.Client.WinForms/Impostor.Client.WinForms.csproj");
+
+ // Server.
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "win-x64");
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "osx-x64");
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-x64");
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm");
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64");
+ });
+
+Task("Test")
+ .IsDependentOn("Build")
+ .Does(() => {
+ DotNetCoreTest("./src/Impostor.Tests/Impostor.Tests.csproj", new DotNetCoreTestSettings {
+ Configuration = configuration,
+ NoBuild = true
+ });
+ });
+
+Task("Deploy")
+ .IsDependentOn("Test")
+ .Does(() => {
+ Information("Finished.");
+ });
+
+//////////////////////////////////////////////////////////////////////
+// EXECUTION
+//////////////////////////////////////////////////////////////////////
+
+RunTarget(target);
\ No newline at end of file