-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2bf4390
commit 45461b6
Showing
9 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: build-${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
fail-fast: false | ||
steps: | ||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v3 | ||
|
||
- name: Install Mac Dependencies | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install cmake autoconf automake libtool | ||
- name: Install Linux Dependencies | ||
if: runner.os == 'Linux' | ||
run: sudo apt-get install cmake autoconf automake libtool | ||
|
||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Run Cake | ||
run: dotnet run --project ./build/Build.csproj --universalBinary=true | ||
env: | ||
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }} | ||
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
deploy: | ||
name: deploy | ||
if: ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
needs: [ build ] | ||
steps: | ||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v3 | ||
|
||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
#- name: Rename License File | ||
# run: mv ./basis_universal/LICENSE ./basis_universal/LICENSE | ||
|
||
- name: Run CAKE | ||
run: dotnet run --project ./build/Build.csproj -- --target=Package --universalBinary=true --toolname=basisu --executablename=basisu --commandname=mgcb-basisu --licensepath=basis_universal/LICENSE | ||
env: | ||
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }} | ||
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Make a release | ||
if: github.ref_type == 'tag' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: 'MonoGame.Tool.FFprobe ${{ github.ref_name }}' | ||
tag: ${{ github.ref_name }} | ||
allowUpdates: true | ||
removeArtifacts: true | ||
artifacts: "artifacts/**/*.nupkg" | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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}") = "Build", "build\Build.csproj", "{05EA3CA1-0ABE-4772-978B-DCC60854A51C}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Tool.BuildScripts", "buildscripts\MonoGame.Tool.BuildScripts.csproj", "{6CE6C044-1BE5-4380-9CFD-FB1E0CFD013B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{05EA3CA1-0ABE-4772-978B-DCC60854A51C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{05EA3CA1-0ABE-4772-978B-DCC60854A51C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{05EA3CA1-0ABE-4772-978B-DCC60854A51C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{05EA3CA1-0ABE-4772-978B-DCC60854A51C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6CE6C044-1BE5-4380-9CFD-FB1E0CFD013B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6CE6C044-1BE5-4380-9CFD-FB1E0CFD013B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6CE6C044-1BE5-4380-9CFD-FB1E0CFD013B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6CE6C044-1BE5-4380-9CFD-FB1E0CFD013B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dotnet run --project build/Build.csproj --universalBinary=true -- $args | ||
exit $LASTEXITCODE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dotnet run --project ./build/Build.csproj --universalBinary=true -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.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" /> | ||
<Using Include="Cake.Common.IO" /> | ||
<Using Include="Cake.Common" /> | ||
<Using Include="Cake.Core" /> | ||
<Using Include="Cake.Core.Diagnostics" /> | ||
<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" /> | ||
<PackageReference Include="Cake.Homebrew" Version="0.3.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\buildscripts\MonoGame.Tool.BuildScripts.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace BuildScripts; | ||
|
||
[TaskName("Build Linux")] | ||
[IsDependentOn(typeof(PrepTask))] | ||
[IsDependeeOf(typeof(BuildToolTask))] | ||
public sealed class BuildLinuxTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => context.IsRunningOnLinux(); | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
var buildWorkingDir = "basis_universal/"; | ||
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "CMakeLists.txt" }); | ||
context.StartProcess("make", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "" }); | ||
context.CopyFile($"{buildWorkingDir}basisu", $"{context.ArtifactsDir}/basisu"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName("Build macOS")] | ||
[IsDependentOn(typeof(PrepTask))] | ||
[IsDependeeOf(typeof(BuildToolTask))] | ||
public sealed class BuildMacOSTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => context.IsRunningOnMacOs(); | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
var buildWorkingDir = "basis_universal/"; | ||
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "-DCMAKE_OSX_ARCHITECTURES=\"x86_64;arm64\" CMakeLists.txt" }); | ||
context.StartProcess("make", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "" }); | ||
var files = Directory.GetFiles(System.IO.Path.Combine (buildWorkingDir, "bin_osx"), "basisu", SearchOption.TopDirectoryOnly); | ||
context.CopyFile(files[0], $"{context.ArtifactsDir}/basisu"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace BuildScripts; | ||
|
||
[TaskName("Build Windows")] | ||
[IsDependentOn(typeof(PrepTask))] | ||
[IsDependeeOf(typeof(BuildToolTask))] | ||
public sealed class BuildWindowsTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => context.IsRunningOnWindows(); | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
var buildWorkingDir = "basis_universal/"; | ||
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "CMakeLists.txt" }); | ||
context.StartProcess("make", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "" }); | ||
var files = Directory.GetFiles(System.IO.Path.Combine (buildWorkingDir, "bin_windows"), "basisu.exe", SearchOption.TopDirectoryOnly); | ||
context.CopyFile(files[0], $"{context.ArtifactsDir}/basisu.exe"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace BuildScripts; | ||
|
||
public static class Program | ||
{ | ||
public static int Main(string[] args) | ||
=> new CakeHost() | ||
.AddAssembly(typeof(BuildContext).Assembly) | ||
.UseWorkingDirectory("../") | ||
.UseContext<BuildContext>() | ||
.Run(args); | ||
} |