Skip to content

Commit

Permalink
Sl025 GitHub build (#5)
Browse files Browse the repository at this point in the history
* github build
  • Loading branch information
arakis committed Nov 1, 2019
1 parent 3e10cda commit a4c1fad
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 27 deletions.
49 changes: 35 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
name: Greet Everyone
name: Abanu Testing
# This workflow is triggered on pushes to the repository.
on: [push]

jobs:
build:
# Job name is Greeting
name: Greeting
# This job runs on Linux
runs-on: ubuntu-latest
build-unix:
name: Linux Test
runs-on: ubuntu-18.04
steps:
# This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action
- name: Hello world
uses: actions/hello-world-javascript-action@v1
- uses: actions/checkout@v1
- name: Update Package respository
run: sudo apt-get -y -o Acquire::Check-Valid-Until=false update
- name: Install Packages
run: sudo apt-get install -y --no-install-recommends git wget nasm qemu-system-x86 mtools xorriso grub-common grub-pc-bin grub-efi-amd64-bin grub-efi-ia32-bin
- name: Set Permissions
run: chmod +x $GITHUB_WORKSPACE/abctl
- name: Configure
run: $GITHUB_WORKSPACE/abctl configure cloud-test
- name: Build
run: $GITHUB_WORKSPACE/abctl build all
- name: Test
run: $GITHUB_WORKSPACE/abctl test cloud
build-mswin:
name: Windows Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
who-to-greet: 'Mona the Octocat'
id: hello
# This step prints an output (time) from the previous step's action.
- name: Echo the greeting's time
run: echo 'The time was ${{ steps.hello.outputs.time }}.'
submodules: recursive
#- uses: crazy-max/ghaction-chocolatey@v1
- name: Configure
# TODO: change dir in bat file
#run: "external/MOSA-Project/Source/Compile.bat"
run: "./Compile.bat"
working-directory: external/MOSA-Project/Source
- name: Build Assemblies
run: "./build.bat"
- name: Build Binaries
run: bin/Abanu.Tools.Build.exe build --native --bin=all --image
- name: Test
run: bin/Abanu.Tools.Build.exe run --emulator=qemu --boot=direct --test
8 changes: 4 additions & 4 deletions abctl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -x
#set -x

# abort on error
set -eE -o functrace
Expand Down Expand Up @@ -215,7 +215,7 @@ function build {

builder)
# mono: /verbosity:minimal
(cd src && ${msbuild} Abanu.Tools.sln /p:Configuration=Release -verbosity:minimal -m)
(cd src && ${msbuild} Abanu.Tools.sln /p:Configuration=Release /verbosity:minimal /p:RunCodeAnalysis=false -m)
cp external/MOSA-Project/bin/Mosa.Plug.Korlib.dll bin
cp external/MOSA-Project/bin/Mosa.Plug.Korlib.x86.dll bin
cp external/MOSA-Project/bin/Mosa.Plug.Korlib.x64.dll bin
Expand All @@ -225,10 +225,10 @@ function build {

assembly)
#(cd src && ${msbuild} Abanu.Kernel.sln /p:Configuration=Debug -verbosity:minimal -m)
set -x
#set -x

# mono: /verbosity:minimal
(cd src && ${msbuild} Abanu.sln /p:Configuration=Debug -verbosity:minimal -m)
(cd src && ${msbuild} Abanu.sln /p:Configuration=Debug /verbosity:minimal /p:RunCodeAnalysis=false -m)
;;

native)
Expand Down
32 changes: 32 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
if exist %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe set MSBUILD=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
if exist %SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe set MSBUILD=%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\msbuild.exe"

if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\msbuild.exe"
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"
if exist "D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" set MSBUILD="D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"

if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\msbuild.exe"
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\msbuild.exe"
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe" set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe"
if exist "D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe" set MSBUILD="D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe"

IF EXIST external\MOSA-Project\bin\Mosa.Plug.Korlib.dll GOTO BUILD

REM TODO: Change dir in bat file
cd external\MOSA-Project\Source
call Compile.bat
cd ..\..\..

:BUILD

mkdir bin
copy external\MOSA-Project\bin\Mosa.Plug.Korlib.dll bin
copy external\MOSA-Project\bin\Mosa.Plug.Korlib.x86.dll bin
copy external\MOSA-Project\bin\Mosa.Plug.Korlib.x64.dll bin
copy external\MOSA-Project\bin\dnlib.* bin
copy "external\MOSA-Project\bin\Priority Queue.dll" bin

%MSBUILD% src/Abanu.sln /p:Configuration=debug /verbosity:minimal
4 changes: 2 additions & 2 deletions src/Abanu.Kernel.Core/KernelStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public static unsafe void StartupStage2()
Scheduler.CreateThread(userProc, new ThreadStartOptions(Thread2) { AllowUserModeIOPort = true, DebugName = "UserThread2", Priority = -5 });
userProc.Start();

KernelMessage.WriteLine(KConfig.SelfTestPassedMarker);

var fileProc = ProcessManager.StartProcess("Service.Basic");
FileServ = fileProc.Service;

Expand Down Expand Up @@ -405,6 +403,8 @@ public static void AppMain()
{
KernelMessage.WriteLine("Kernel ready");

KernelMessage.WriteLine(KConfig.SelfTestPassedMarker);

// We have nothing to do (yet). So let's stop.
Debug.Break();
}
Expand Down
32 changes: 31 additions & 1 deletion src/Abanu.Tools.Build/ProcessResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,53 @@

using System;
using System.Diagnostics;
using System.Timers;

namespace Abanu.Tools.Build
{
public class ProcessResult : CommandResult, IDisposable
{
public Process Process;

public ProcessResult(Process proc)
public ProcessResult(Process proc, TimeSpan? timeout = null)
{
Process = proc;
if (timeout != null)
{
var ts = (TimeSpan)timeout;
if (ts != TimeSpan.Zero)
{
Timer = new Timer(((TimeSpan)timeout).TotalMilliseconds);
Timer.Elapsed += ElapsedEventHandler;
Timer.Start();
}
}
}

private Timer Timer;

private void ElapsedEventHandler(object sender, ElapsedEventArgs e)
{
Timer.Stop();
Console.WriteLine("Timeout");
Environment.Exit(1);
}

public void Dispose()
{
try
{
if (Timer != null)
Timer.Stop();

Process?.Dispose();

if (Timer != null)
{
var t = Timer;
Timer = null;
t.Dispose();
}
}
catch (Exception ex)
{
Expand Down
19 changes: 13 additions & 6 deletions src/Abanu.Tools.Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Abanu.Kernel.Core;
using Mosa.Compiler.MosaTypeSystem;

#pragma warning disable CA1307 // Specify StringComparison

namespace Abanu.Tools.Build
{

Expand Down Expand Up @@ -74,6 +76,8 @@ private static CommandResult TryBuildNative(CommandArgs args)
Exec("${nasm} -f bin ${ABANU_PROJDIR}/src/Abanu.Native.${ABANU_ARCH}/LoadTaskRegister.s -o ${ABANU_BINDIR}/${ABANU_ARCH}/Abanu.LoadTaskRegister.o");
Exec("${nasm} -f bin ${ABANU_PROJDIR}/src/Abanu.Native.${ABANU_ARCH}/DebugFunction1.s -o ${ABANU_BINDIR}/${ABANU_ARCH}/Abanu.DebugFunction1.o");
Exec("${nasm} -f bin ${ABANU_PROJDIR}/src/Abanu.Native.${ABANU_ARCH}/SysCall.s -o ${ABANU_BINDIR}/${ABANU_ARCH}/Abanu.SysCall.o");
Exec("${nasm} -f bin ${ABANU_PROJDIR}/src/Abanu.Native.${ABANU_ARCH}/ReadFlags.s -o ${ABANU_BINDIR}/${ABANU_ARCH}/Abanu.ReadFlags.o");
Exec("${nasm} -f bin ${ABANU_PROJDIR}/src/Abanu.Native.${ABANU_ARCH}/CpuCyclesSinceBoot.s -o ${ABANU_BINDIR}/${ABANU_ARCH}/Abanu.CpuCyclesSinceBoot.o");
}
return null;
}
Expand All @@ -88,7 +92,7 @@ private static CommandResult TryBuildBin(CommandArgs args)

var newArgs = args.RemoveFlag("bin");

foreach (var img in images.Where(s => s != "all"))
foreach (var img in images.Where(s => s != "all" && !s.StartsWith("--")))
BuildImage(img + " " + newArgs);
return null;
}
Expand Down Expand Up @@ -165,7 +169,7 @@ private static CommandResult RunQemu(CommandArgs args)
Console.WriteLine("TEST PASSED");
Environment.Exit(0);
}
});
}, TimeSpan.FromSeconds(60));

Console.WriteLine("Test FAILED");
Environment.Exit(1);
Expand All @@ -179,9 +183,9 @@ private static CommandResult RunQemu(CommandArgs args)
return null;
}

private static ProcessResult Exec(CommandArgs args, Action<string, Process> onNewLine = null)
private static ProcessResult Exec(CommandArgs args, Action<string, Process> onNewLine = null, TimeSpan? timeout = null)
{
using (var result = ExecAsync(args, true, onNewLine))
using (var result = ExecAsync(args, true, onNewLine, timeout))
{
result.WaitForExit();
result?.Dispose();
Expand All @@ -194,7 +198,7 @@ private static ProcessResult ExecAsync(CommandArgs args)
return ExecAsync(args, false);
}

private static ProcessResult ExecAsync(CommandArgs args, bool redirect, Action<string, Process> onNewLine = null)
private static ProcessResult ExecAsync(CommandArgs args, bool redirect, Action<string, Process> onNewLine = null, TimeSpan? timeout = null)
{
if (!args.IsSet())
return null;
Expand All @@ -211,12 +215,15 @@ private static ProcessResult ExecAsync(CommandArgs args, bool redirect, Action<s
{
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
start.RedirectStandardError = true;
start.UseShellExecute = false;
}

Console.WriteLine(fileName + " " + arguments);

var proc = Process.Start(start);
var result = new ProcessResult(proc, timeout);

if (redirect)
{

Expand Down Expand Up @@ -251,7 +258,7 @@ private static ProcessResult ExecAsync(CommandArgs args, bool redirect, Action<s
Console.WriteLine(error);
}

return new ProcessResult(proc);
return result;
}

private static CommandResult BuildImage(CommandArgs args)
Expand Down
11 changes: 11 additions & 0 deletions src/ressources/SharedProjectSettings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<!--<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)codeanalysis\default.ruleset</CodeAnalysisRuleSet>-->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeQuality.Analyzers">
<Version>2.9.5</Version>
Expand All @@ -27,4 +28,14 @@
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)codeanalysis/stylecop.json" Link="stylecop.json" />
</ItemGroup>

<Target Name="DisableAnalyzers"
BeforeTargets="CoreCompile"
Condition="'$(UseRoslynAnalyzers)' == 'false' or '$(RunCodeAnalysis)' == 'false' or '$(RunCodeAnalysis)' == 'never'" >
<!-- Disable analyzers via an MSBuild property settable on the command line. -->
<ItemGroup>
<Analyzer Remove="@(Analyzer)" />
</ItemGroup>
</Target>

</Project>

0 comments on commit a4c1fad

Please sign in to comment.