Skip to content
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
38 changes: 26 additions & 12 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
name: .NET
name: .NET build and test

on:
push:
branches: [ main ]
branches: [ main, automated-nuget.org-publish ]
pull_request:
branches: [ main ]
branches: [ main, automated-nuget.org-publish ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Bump versions
uses: SiqiLu/dotnet-bump-version@master
with:
version_files: "**/*.csproj"
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build --verbosity normal --configuration Release
- name: "Build & test"
run: |
echo "done!"
pwd

deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Publish
run: dotnet publish --configuration Release --no-restore
- name: NugetPush
run: |
ls ./GithubActionsHelloWorld/bin/Release
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.*nupkg --skip-duplicate --include-symbols -p:SymbolPackageFormat=snupkg --api-key ${{secrets.NUGET_TOKEN}} --source https://int.nugettest.org/
- uses: papeloto/action-zip@v1
with:
files: ./bin/Release/net5.0/win-x64/publish/
files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
dest: GithubActionsHelloWorld.zip
- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"redhat.vscode-yaml"
]
}
14 changes: 0 additions & 14 deletions GithubActionsHelloWorld.csproj

This file was deleted.

36 changes: 36 additions & 0 deletions GithubActionsHelloWorld.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31702.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GithubActionsHelloWorld", "GithubActionsHelloWorld\GithubActionsHelloWorld.csproj", "{61D51FF5-54B5-4D4D-8374-0476FF605F57}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GithubActionsHelloWorldTests", "GithubActionsHelloWorldTests\GithubActionsHelloWorldTests.csproj", "{1756945F-FE1B-498C-897C-743DD7B791DA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A0700FEC-48D8-490C-8136-B200F4317767}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{61D51FF5-54B5-4D4D-8374-0476FF605F57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61D51FF5-54B5-4D4D-8374-0476FF605F57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61D51FF5-54B5-4D4D-8374-0476FF605F57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61D51FF5-54B5-4D4D-8374-0476FF605F57}.Release|Any CPU.Build.0 = Release|Any CPU
{1756945F-FE1B-498C-897C-743DD7B791DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1756945F-FE1B-498C-897C-743DD7B791DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1756945F-FE1B-498C-897C-743DD7B791DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1756945F-FE1B-498C-897C-743DD7B791DA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DF7E6DBA-1CE0-4A5B-932A-0759477DD349}
EndGlobalSection
EndGlobal
17 changes: 17 additions & 0 deletions GithubActionsHelloWorld/GithubActionsHelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Version Condition="'$(GITHUB_RUN_NUMBER)' != ''">1.0.$(GITHUB_RUN_NUMBER)</Version>
<Version Condition="'$(GITHUB_RUN_NUMBER)' == ''">0.0.1</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<PackageVersion>$(Version)</PackageVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageId>GithubActionsHelloWorld</PackageId>
</PropertyGroup>

</Project>
14 changes: 14 additions & 0 deletions GithubActionsHelloWorld/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;

namespace GithubActionsHelloWorld
{
public class Program
{
public async static Task Main(string[] args)
{
await Task.Delay(100);
Console.WriteLine("Hello World!");
}
}
}
16 changes: 16 additions & 0 deletions GithubActionsHelloWorldTests/GithubActionsHelloWorldTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using GithubActionsHelloWorld;
using System.Threading.Tasks;
using Xunit;

namespace GithubActionsHelloWorldTests
{
public class GithubActionsHelloWorldTest
{
[Fact]
public async Task Main_ShouldRunWithoutError()
{
var args = new string[] { "WrongParameterCount" };
await Program.Main(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GithubActionsHelloWorld\GithubActionsHelloWorld.csproj" />
</ItemGroup>

</Project>
12 changes: 0 additions & 12 deletions Program.cs

This file was deleted.