Skip to content

Commit 311cf7a

Browse files
GitHub Actions support (#16)
* GitHub Actions support This PR adds support for using GitHub Actions to build the project. It also adds `Build.csproj` which is a `Microsoft.Build.Traversal` used for building / testing / packaging everything and updates `global.json` to use .NET Core SDK 3.1.302. There are two GH workflows - one for building and testing (run on every PR to master) and one for building, testing and packaging (used for publishing to MyGet). * Fix reference assemblies * No need for netcoreapp2.2 * Force Windows to use latest .NET * Tweak for #16: Test removing specific SDKs (#17) * Test removing specific SDKs * Restore fetch-depth That's a stupid default. Co-authored-by: Nick Craver <[email protected]>
1 parent 5d157b9 commit 311cf7a

File tree

7 files changed

+86
-3
lines changed

7 files changed

+86
-3
lines changed

.github/workflows/build.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build & Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- 'docs/**' # Don't run workflow when files are only in the /docs directory
9+
10+
jobs:
11+
build-ubuntu:
12+
runs-on: ubuntu-latest
13+
if: "!contains(github.event.head_commit.message, 'ci skip')"
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: .NET Build
20+
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
21+
- name: .NET Test
22+
run: dotnet test Build.csproj -c Release --no-build --nologo /p:CI=true
23+
build-windows:
24+
runs-on: windows-latest
25+
if: "!contains(github.event.head_commit.message, 'ci skip')"
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
- name: .NET Build
32+
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
33+
- name: .NET Test
34+
run: dotnet test Build.csproj -c Release --no-build --nologo /p:CI=true

.github/workflows/packages.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build, Test & Package
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- 'docs/**' # Don't run workflow when files are only in the /docs directory
9+
10+
jobs:
11+
build-ubuntu:
12+
runs-on: ubuntu-latest
13+
if: "!contains(github.event.head_commit.message, 'ci skip')"
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: .NET Build
20+
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
21+
- name: .NET Test
22+
run: dotnet test Build.csproj -c Release --no-build --nologo /p:CI=true
23+
build-windows:
24+
needs: build-ubuntu
25+
runs-on: windows-latest
26+
if: "!contains(github.event.head_commit.message, 'ci skip')"
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
- name: .NET Build
33+
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
34+
- name: .NET Test
35+
run: dotnet test Build.csproj -c Release --no-build --nologo /p:CI=true
36+
- name: .NET Pack
37+
run: dotnet pack Build.csproj --no-build -c Release --nologo /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true
38+
- name: Push to MyGet
39+
run: dotnet nuget push ${env:GITHUB_WORKSPACE}\.nupkgs\*.nupkg -s https://www.myget.org/F/stackoverflow/api/v2/package -k ${{ secrets.MYGET_API_KEY }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ obj
44
*.suo
55
*.user
66
*.nupkgs
7+
.idea/*
78
.vs/*
9+
.DS_Store

Build.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.Build.Traversal/2.0.24">
2+
<ItemGroup>
3+
<ProjectReference Include="src\**\*.csproj" />
4+
<ProjectReference Include="samples\**\*.csproj" />
5+
<ProjectReference Include="tests\**\*.csproj" />
6+
</ItemGroup>
7+
</Project>

global.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
3-
"version": "3.1.201",
4-
"rollForward": "latestMajor",
3+
"version": "3.1.300",
4+
"rollForward": "latestMinor",
55
"allowPrerelease": false
66
}
77
}

src/StackExchange.Utils.Http/StackExchange.Utils.Http.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<PackageReference Include="Jil" Version="2.17.0" />
1515
<PackageReference Include="protobuf-net" Version="2.4.1" />
1616
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
17+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" IncludeAssets="runtime;build;native;contentfiles;analyzers" />
1718

1819
<Compile Update="Extensions.*.cs" DependentUpon="Extensions.cs" />
1920
</ItemGroup>

tests/StackExchange.Utils.Tests/StackExchange.Utils.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp2.2;netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
44
</PropertyGroup>
55
<ItemGroup>
66
<ProjectReference Include="../../src/StackExchange.Utils.Http/StackExchange.Utils.Http.csproj" />

0 commit comments

Comments
 (0)