Skip to content

Commit

Permalink
Use the new buildscripts submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-cpp committed Nov 7, 2023
1 parent 113b339 commit 93cf6f3
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 98 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/main.yml
Expand Up @@ -11,6 +11,8 @@ jobs:
matrix:
os: [windows-latest, macos-latest, ubuntu-20.04]
steps:
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
Expand All @@ -31,12 +33,9 @@ jobs:
submodules: recursive
- name: Run CAKE
run: dotnet run --project ./build/Build.csproj
- name: Package artifacts
uses: actions/upload-artifact@main
with:
name: SDL-${{ matrix.os }}
path: |
artifacts/*
env:
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }}
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
deploy:
name: deploy
runs-on: ubuntu-latest
Expand All @@ -46,30 +45,17 @@ jobs:
needs: [ build ]
if: ${{ github.event_name == 'push' }}
steps:
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifacts for Windows x64
uses: actions/download-artifact@v3
with:
name: SDL-windows-latest
path: artifacts-windows-x64
- name: Download artifacts for macOS
uses: actions/download-artifact@v3
with:
name: SDL-macos-latest
path: artifacts-macos
- name: Download artifacts for Linux x64
uses: actions/download-artifact@v3
with:
name: SDL-ubuntu-20.04
path: artifacts-linux-x64
- name: Run CAKE
run: dotnet run --project ./build/Build.csproj -- "--target=Package"
- name: Push packages
run: dotnet nuget push src/bin/Release/*.nupkg --source https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json --api-key ${GITHUB_TOKEN}
run: dotnet run --project ./build/Build.csproj -- --target=Package --libraryname=FreeImage --licensepath=freeimage/license-fi.txt
env:
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }}
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make a release
uses: ncipollo/release-action@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
@@ -1,3 +1,6 @@
[submodule "sdl"]
path = sdl
url = https://github.com/libsdl-org/SDL.git
[submodule "buildscripts"]
path = buildscripts
url = https://github.com/MonoGame/MonoGame.Library.BuildScripts.git
2 changes: 0 additions & 2 deletions MonoGame.Library.SDL.sln → Build.sln
Expand Up @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Library.SDL", "src\MonoGame.Library.SDL.csproj", "{F9BD9E87-2B0B-4CB8-9C39-3FACD66E14AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{8363325E-56EB-4B87-B170-C28237FB80CC}"
EndProject
Global
Expand Down
14 changes: 13 additions & 1 deletion build/Build.csproj
@@ -1,12 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<Using Include="Cake.Frosting" />
<Using Include="Cake.Common.Build" />
<Using Include="Cake.Common.Diagnostics" />
<Using Include="Cake.Common.Tools.DotNet" />
<Using Include="Cake.Common.Tools.DotNet.MSBuild" />
<Using Include="Cake.Common.Tools.DotNet.Pack" />
Expand All @@ -17,8 +23,14 @@
<Using Include="Cake.Core.IO" />
<Using Include="Cake.FileHelpers" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.FileHelpers" Version="6.1.3" />
<PackageReference Include="Cake.Frosting" Version="3.1.0" />
</ItemGroup>
</Project>

<ItemGroup>
<ProjectReference Include="..\buildscripts\MonoGame.Library.BuildScripts.csproj" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions build/BuildLinuxTask.cs
Expand Up @@ -2,6 +2,8 @@
namespace BuildScripts;

[TaskName("Build Linux")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildLinuxTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnLinux();
Expand Down
2 changes: 2 additions & 0 deletions build/BuildMacOSTask.cs
Expand Up @@ -2,6 +2,8 @@
namespace BuildScripts;

[TaskName("Build macOS")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildMacOSTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnMacOs();
Expand Down
2 changes: 2 additions & 0 deletions build/BuildWindowsTask.cs
Expand Up @@ -2,6 +2,8 @@
namespace BuildScripts;

[TaskName("Build Windows")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildWindowsTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnWindows();
Expand Down
24 changes: 0 additions & 24 deletions build/PackageTask.cs

This file was deleted.

19 changes: 1 addition & 18 deletions build/Program.cs
Expand Up @@ -5,25 +5,8 @@ public static class Program
{
public static int Main(string[] args)
=> new CakeHost()
.AddAssembly(typeof(BuildContext).Assembly)
.UseWorkingDirectory("../")
.UseContext<BuildContext>()
.Run(args);
}

public class BuildContext : FrostingContext
{
public string ArtifactsDir { get; }

public BuildContext(ICakeContext context) : base(context)
{
ArtifactsDir = context.Arguments("artifactsDir", "artifacts").FirstOrDefault();
}
}

[TaskName("Default")]
[IsDependentOn(typeof(BuildWindowsTask))]
[IsDependentOn(typeof(BuildMacOSTask))]
[IsDependentOn(typeof(BuildLinuxTask))]
public class DefaultTask : FrostingTask
{
}
1 change: 1 addition & 0 deletions buildscripts
Submodule buildscripts added at 150661
29 changes: 0 additions & 29 deletions src/MonoGame.Library.SDL.csproj

This file was deleted.

0 comments on commit 93cf6f3

Please sign in to comment.