Skip to content

Commit 184aac5

Browse files
authored
πŸ‘·β€β™‚οΈ Add GitHub actions support (#45)
1 parent fa754e8 commit 184aac5

File tree

9 files changed

+142
-57
lines changed

9 files changed

+142
-57
lines changed

β€Ž.github/workflows/dotnet-build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build & Test [.NET Core]
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
name: Build & Test
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Setup .NET Core
18+
uses: actions/setup-dotnet@v1
19+
with:
20+
dotnet-version: 5.0.x
21+
- name: Install dependencies
22+
run: dotnet restore
23+
- name: Build
24+
run: dotnet build --configuration Release --no-restore
25+
- name: Test
26+
run: dotnet test --no-restore --verbosity normal
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish [.NET Core]
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
publish:
10+
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
# Build library and run tests
16+
- uses: actions/checkout@v2
17+
- name: Setup .NET Core
18+
uses: actions/setup-dotnet@v1
19+
with:
20+
dotnet-version: 5.0.x
21+
- name: Install dependencies
22+
run: dotnet restore
23+
- name: Build
24+
run: dotnet build --configuration Release --no-restore
25+
- name: Test
26+
run: dotnet test --no-restore --verbosity normal
27+
28+
# Set up environment variables
29+
# The version number can be extracted from the currently checked out tag,
30+
# which has the format 'refs/tags/v*'.
31+
- name: Extract version number
32+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
33+
34+
# Create the NuGet package
35+
# Note that we substr the release version to get the numbers only, without
36+
# the 'v' prefix.
37+
- name: Pack binary
38+
run: dotnet pack --configuration Release --no-restore -p:PackageVersion=${RELEASE_VERSION:1}
39+
40+
# Create a GitHub release
41+
- name: Create a Release
42+
id: create_release
43+
uses: actions/create-release@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
tag_name: ${{ env.RELEASE_VERSION }}
48+
release_name: Release ${{ env.RELEASE_VERSION }}
49+
draft: false
50+
prerelease: ${{ contains(env.RELEASE_VERSION, '-') }}
51+
52+
# Push the NuGet package to the package providers
53+
- name: Push release to NuGet
54+
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate

β€ŽBearded.Graphics.Examples/01.Basics/GameWindow.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ sealed class GameWindow : Window
2424
private ShaderProgram shaderProgram = null!;
2525
private Renderer renderer = null!;
2626

27-
public GameWindow()
28-
: base(
29-
new NativeWindowSettings
30-
{
31-
API = ContextAPI.OpenGL,
32-
APIVersion = new Version(3, 2),
33-
Title = "Basic example",
34-
WindowState = WindowState.Normal,
35-
Size = new Vector2i(1280, 720)
36-
}
37-
)
27+
protected override NativeWindowSettings GetSettings()
3828
{
29+
return new NativeWindowSettings
30+
{
31+
API = ContextAPI.OpenGL,
32+
APIVersion = new Version(3, 2),
33+
Title = "Basic example",
34+
WindowState = WindowState.Normal,
35+
Size = new Vector2i(1280, 720)
36+
};
3937
}
4038

4139
protected override void OnLoad()

β€ŽBearded.Graphics.Examples/02.IndexBuffer/GameWindow.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ sealed class GameWindow : Window
2424
private Vector2 quadPosition = Vector2.Zero;
2525
private Vector2 quadVelocity = new Vector2(0.8f, 0.7f);
2626

27-
public GameWindow()
28-
: base(
29-
new NativeWindowSettings
30-
{
31-
API = ContextAPI.OpenGL,
32-
APIVersion = new Version(3, 2),
33-
Title = "IndexBuffer example",
34-
WindowState = WindowState.Normal,
35-
Size = new Vector2i(1280, 720)
36-
}
37-
)
27+
protected override NativeWindowSettings GetSettings()
3828
{
29+
return new NativeWindowSettings
30+
{
31+
API = ContextAPI.OpenGL,
32+
APIVersion = new Version(3, 2),
33+
Title = "IndexBuffer example",
34+
WindowState = WindowState.Normal,
35+
Size = new Vector2i(1280, 720)
36+
};
3937
}
4038

4139
protected override void OnLoad()

β€ŽBearded.Graphics.Examples/08.PostProcessing/GameWindow.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ sealed class GameWindow : Window
3535
private int width;
3636
private int height;
3737

38-
public GameWindow()
39-
: base(
40-
new NativeWindowSettings
41-
{
42-
API = ContextAPI.OpenGL,
43-
APIVersion = new Version(3, 2),
44-
Title = "PostProcessing example",
45-
WindowState = WindowState.Normal,
46-
Size = new Vector2i(1280, 720)
47-
}
48-
)
38+
protected override NativeWindowSettings GetSettings()
4939
{
40+
return new NativeWindowSettings
41+
{
42+
API = ContextAPI.OpenGL,
43+
APIVersion = new Version(3, 2),
44+
Title = "PostProcessing example",
45+
WindowState = WindowState.Normal,
46+
Size = new Vector2i(1280, 720)
47+
};
5048
}
5149

5250
protected override void OnLoad()

β€ŽBearded.Graphics.Examples/12.Text/GameWindow.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@ sealed class GameWindow : Window
2727
private int height;
2828
private bool needsResize;
2929

30-
public GameWindow()
31-
: base(
32-
new NativeWindowSettings
33-
{
34-
API = ContextAPI.OpenGL,
35-
APIVersion = new Version(3, 2),
36-
Title = "Text example",
37-
WindowState = WindowState.Normal,
38-
Size = new Vector2i(1280, 720)
39-
}
40-
)
30+
protected override NativeWindowSettings GetSettings()
4131
{
32+
return new NativeWindowSettings
33+
{
34+
API = ContextAPI.OpenGL,
35+
APIVersion = new Version(3, 2),
36+
Title = "Text example",
37+
WindowState = WindowState.Normal,
38+
Size = new Vector2i(1280, 720)
39+
};
4240
}
4341

4442
protected override void OnLoad()

β€ŽBearded.Graphics.Examples/20.Mandelbrot/GameWindow.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ sealed class GameWindow : Window
2020
private readonly Vector2Uniform offset = new Vector2Uniform("offset");
2121
private PostProcessor renderer;
2222

23-
public GameWindow()
24-
: base(
25-
new NativeWindowSettings
26-
{
27-
API = ContextAPI.OpenGL,
28-
APIVersion = new Version(3, 2),
29-
Title = "Mandelbrot example",
30-
WindowState = WindowState.Normal,
31-
Size = new Vector2i(1280, 720)
32-
}
33-
)
23+
protected override NativeWindowSettings GetSettings()
3424
{
25+
return new NativeWindowSettings
26+
{
27+
API = ContextAPI.OpenGL,
28+
APIVersion = new Version(3, 2),
29+
Title = "Mandelbrot example",
30+
WindowState = WindowState.Normal,
31+
Size = new Vector2i(1280, 720)
32+
};
3533
}
3634

3735
protected override void OnLoad()

β€ŽBearded.Graphics/Bearded.Graphics.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
5-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
64
<LangVersion>8</LangVersion>
75
<Nullable>annotations</Nullable>
86
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>Bearded.Graphics</id>
5+
<version>$version$</version>
6+
<title>$title$</title>
7+
<authors>$author$</authors>
8+
<owners>$author$</owners>
9+
<licenseUrl>https://github.com/beardgame/graphics/blob/master/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/beardgame/graphics</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>Object oriented C# OpenGL graphics library built on top of OpenTK.</description>
13+
<releaseNotes>Initial release.</releaseNotes>
14+
<copyright>Copyright 2021</copyright>
15+
<tags>gamedev,opentk,opengl,graphics</tags>
16+
</metadata>
17+
</package>

0 commit comments

Comments
Β (0)