Skip to content

Commit 404249e

Browse files
author
Alexis Huvier
committed
feat(project): Create
0 parents  commit 404249e

File tree

13 files changed

+278
-0
lines changed

13 files changed

+278
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET
5+
6+
on:
7+
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
8+
release:
9+
types:
10+
- published # Run the workflow when a new GitHub release is published
11+
12+
env:
13+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
14+
DOTNET_NOLOGO: true
15+
NuGetDirectory: ${{ github.workspace}}/nuget
16+
17+
defaults:
18+
run:
19+
shell: pwsh
20+
21+
jobs:
22+
create_nuget:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup .NET
30+
uses: actions/setup-dotnet@v3
31+
32+
- name: Restore
33+
run: dotnet restore
34+
35+
- name: Build
36+
run: dotnet build SharpEngine.Python/SharpEngine.Python.csproj -c Release
37+
38+
- name: Pack Nuget
39+
run: dotnet pack SharpEngine.Python/SharpEngine.Python.csproj -c Release --no-build --output ${{ env.NuGetDirectory }}
40+
41+
- uses: actions/upload-artifact@v3
42+
with:
43+
name: nuget
44+
if-no-files-found: error
45+
retention-days: 7
46+
path: ${{ env.NuGetDirectory }}/*.nupkg
47+
48+
validate_nuget:
49+
runs-on: ubuntu-latest
50+
needs: [ create_nuget ]
51+
steps:
52+
- name: Setup .NET
53+
uses: actions/setup-dotnet@v3
54+
55+
- uses: actions/download-artifact@v3
56+
with:
57+
name: nuget
58+
path: ${{ env.NuGetDirectory }}
59+
60+
- name: Install nuget validator
61+
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
62+
63+
- name: Validate package
64+
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
65+
continue-on-error: true
66+
67+
run_test:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v3
71+
- name: Setup .NET
72+
uses: actions/setup-dotnet@v3
73+
- name: Run tests
74+
run: dotnet test --configuration Release
75+
76+
deploy:
77+
runs-on: ubuntu-latest
78+
needs: [ validate_nuget, run_test ]
79+
steps:
80+
- uses: actions/download-artifact@v3
81+
with:
82+
name: nuget
83+
path: ${{ env.NuGetDirectory }}
84+
85+
- name: Setup .NET
86+
uses: actions/setup-dotnet@v3
87+
88+
- name: Publish NuGet package
89+
run: |
90+
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
91+
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
92+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bin/
2+
obj/
3+
/packages/
4+
riderModule.iml
5+
/_ReSharper.Caches/

.idea/.idea.SharpEngine.Python/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.SharpEngine.Python/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.SharpEngine.Python/.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.SharpEngine.Python/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
### Légende
4+
[+] Add<br>
5+
[\~] Modification<br>
6+
[-] Suppression<br>
7+
[#] Bug Fixes<br>
8+
[.] Others
9+
10+
### V 1.0.0 - 13/08/2023
11+
[.] First version

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SharpEngine.Python
2+
3+
Python Package of SharpEngine - C# 2D Game Engine
4+
5+
## Installation, Download, Usage
6+
7+
*Coming Soon*
8+
9+
## Dependencies
10+
11+
- Net7
12+
- SharpEngine.Core

SharpEngine.Python.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpEngine.Python", "SharpEngine.Python\SharpEngine.Python.csproj", "{1147BEA8-23AB-48CF-8712-380FB11F3065}"
4+
EndProject
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{22204917-F67B-48AA-BDD1-6E9D29017FBC}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{1147BEA8-23AB-48CF-8712-380FB11F3065}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{1147BEA8-23AB-48CF-8712-380FB11F3065}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{1147BEA8-23AB-48CF-8712-380FB11F3065}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{1147BEA8-23AB-48CF-8712-380FB11F3065}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{22204917-F67B-48AA-BDD1-6E9D29017FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{22204917-F67B-48AA-BDD1-6E9D29017FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{22204917-F67B-48AA-BDD1-6E9D29017FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{22204917-F67B-48AA-BDD1-6E9D29017FBC}.Release|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
EndGlobal

SharpEngine.Python/SEPython.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using SharpEngine.Core.Manager;
2+
3+
namespace SharpEngine.Python;
4+
5+
/// <summary>
6+
/// Static class with extensions and add version functions
7+
/// </summary>
8+
public static class SEPython
9+
{
10+
/// <summary>
11+
/// Add versions to DebugManager
12+
/// </summary>
13+
public static void AddVersions()
14+
{
15+
DebugManager.Versions.Add("SharpEngine.Python", "1.0.0");
16+
}
17+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6+
<Description>Python Package of SharpEngine - 2D Game Engine</Description>
7+
<PackageProjectUrl />
8+
<Authors>LavaPower</Authors>
9+
<Company>LavaPower</Company>
10+
<Copyright>Copyright (c) LavaPower 2021-2023</Copyright>
11+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
12+
<PackageProjectUrl>https://github.com/SharpEngine/SharpEngine.Python</PackageProjectUrl>
13+
<PackageVersion>1.0.0</PackageVersion>
14+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
15+
<PackageReadmeFile>README.md</PackageReadmeFile>
16+
<EnablePackageValisation>true</EnablePackageValisation>
17+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
18+
<RepositoryUrl>https://github.com/SharpEngine/SharpEngine.Python</RepositoryUrl>
19+
<RepositoryType>git</RepositoryType>
20+
<PackageTags>Raylib,SharpEngine,Game,Engine</PackageTags>
21+
<Nullable>enable</Nullable>
22+
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<None Include="../CHANGELOG.md" Pack="true" PackagePath="\" />
26+
<None Include="../README.md" Pack="true" PackagePath="\" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<PackageReference Include="pythonnet" Version="3.0.2" />
31+
<PackageReference Include="SharpEngine.Core" Version="1.4.0" />
32+
</ItemGroup>
33+
</Project>

Testing/Program.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Python.Runtime;
2+
3+
namespace Testing;
4+
5+
internal class Person
6+
{
7+
public string FirstName { get; set; }
8+
public string LastName { get; set; }
9+
10+
public Person(string firstname, string lastname)
11+
{
12+
FirstName = firstname;
13+
LastName = lastname;
14+
}
15+
16+
public string GetFullName() => FirstName + " " + LastName;
17+
}
18+
19+
20+
public static class Program
21+
{
22+
public static void Main(string[] argv)
23+
{
24+
Runtime.PythonDLL = @"C:\Users\Admin\AppData\Local\Programs\Python\Python311\python311.dll";
25+
PythonEngine.Initialize();
26+
27+
using (Py.GIL())
28+
{
29+
using (var scope = Py.CreateScope())
30+
{
31+
scope.Set("Person", PyType.Get(typeof(Person)));
32+
33+
scope.Exec("print(Person('Lilith', 'Winterlight').GetFullName())");
34+
}
35+
}
36+
PythonEngine.Shutdown();
37+
}
38+
}

Testing/Testing.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\SharpEngine.Python\SharpEngine.Python.csproj" />
12+
</ItemGroup>
13+
14+
</Project>

0 commit comments

Comments
 (0)