Browse Source

Add CI support based on GitHub actions

pull/1483/head
FiniteReality 5 years ago
parent
commit
de8fe25a73
4 changed files with 50 additions and 4 deletions
  1. +1
    -1
      .editorconfig
  2. +36
    -0
      .github/workflows/build.yml
  3. +12
    -2
      Directory.Build.props
  4. +1
    -1
      Directory.Build.targets

+ 1
- 1
.editorconfig View File

@@ -8,7 +8,7 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{cmd,config,csproj,cxxproj,json,props,ps1,resx,sh,targets}]
[*.{cmd,config,csproj,cxxproj,json,props,ps1,resx,sh,targets,yml}]
indent_size = 2

[*.sln]


+ 36
- 0
.github/workflows/build.yml View File

@@ -0,0 +1,36 @@
name: Build using .NET Core

on:
push:
branches: [ 3.0 ]
paths-ignore:
- 'docs/**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.3

- name: Install dependencies
run: dotnet restore

- name: Build Discord.Net
run: dotnet build --configuration Release --no-restore

- name: Run Unit Tests
run: dotnet test --no-restore --verbosity normal

- name: Pack Discord.Net
run: dotnet pack --configuration Release

- name: Upload Artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: nupkgs
path: $GITHUB_WORKSPACE/artifacts/pkg/

+ 12
- 2
Directory.Build.props View File

@@ -12,6 +12,11 @@
that is done by the file that imports us.
-->

<!-- Settings used for versioning -->
<PropertyGroup>
<PullRequestNumber Condition="$(GITHUB_REF.StartsWith('refs/pull'))">$([System.String]::Copy('$(GITHUB_REF)').Replace('refs/pull/', '').Replace('/merge', ''))</PullRequestNumber>
</PropertyGroup>

<!-- Default settings that are used by other settings -->
<PropertyGroup>
<BaseArtifactsPath>$(MSBuildThisFileDirectory)artifacts/</BaseArtifactsPath>
@@ -45,7 +50,7 @@
<Product>Discord.Net</Product>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix>alpha</VersionSuffix>
<VersionSuffix Condition="'$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)' != ''">pr$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)</VersionSuffix>
<VersionSuffix Condition="'$(PullRequestNumber)' != ''">pr$(PullRequestNumber)</VersionSuffix>
</PropertyGroup>

<!-- Default settings that are otherwise undefined -->
@@ -59,7 +64,7 @@
<MinClientVersion>4.3</MinClientVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
<PackageIconUrl>https://github.com/Discord-Net/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</PackageIconUrl>
<PackageIcon>PackageLogo.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
@@ -69,6 +74,11 @@
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>

<!-- Package icons -->
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)/docs/marketing/logo/PackageLogo.png" Pack="True" PackagePath="" />
</ItemGroup>

<!-- Default settings for .NET projects that are otherwise undefined -->
<PropertyGroup Condition="'$(TargetRuntime)' != 'Native'">
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>


+ 1
- 1
Directory.Build.targets View File

@@ -16,7 +16,7 @@
<PropertyGroup>
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
<NoWarn>$(NoWarn);NU5105</NoWarn>
<PackageVersion Condition="'$(BUILD_BUILDNUMBER)' != ''">$(Version).$(BUILD_BUILDNUMBER)</PackageVersion>
<PackageVersion Condition="'$(GITHUB_RUN_ID)' != ''">$(Version).$(GITHUB_RUN_ID)</PackageVersion>
</PropertyGroup>

<!-- Package versions for package references across all projects -->


Loading…
Cancel
Save