Skip to content

Commit

Permalink
Merge pull request #10 from merschformann/merschformann/linux-arm-exp…
Browse files Browse the repository at this point in the history
…eriment

Consolidates CLI, supplies LWH & cubes on output, enables single binary compilation, upgrade to net7
  • Loading branch information
merschformann authored Feb 7, 2024
2 parents b153db0 + f2e84ff commit fa7ccc7
Show file tree
Hide file tree
Showing 23 changed files with 138 additions and 119 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ name: build
on: [push]

jobs:
build:
name: build & test
runs-on: windows-latest
strategy:
matrix:
dotnet-version: ['6.0.x' ]
build:
name: build & test
runs-on: windows-latest
strategy:
matrix:
dotnet-version: ["7.0.x"]

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/[email protected]
with:
dotnet-version: ${{ matrix.dotnet-version }}
# - name: Validate version consistency
# run: bash validate-version-consistency.sh
# working-directory: ./Material/Scripts
# shell: bash
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/[email protected]
with:
dotnet-version: ${{ matrix.dotnet-version }}
# - name: Validate version consistency
# run: bash validate-version-consistency.sh
# working-directory: ./Material/Scripts
# shell: bash
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
36 changes: 18 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: publish

on:
workflow_dispatch: # Allow manual trigger
release:
types: [created]
workflow_dispatch: # Allow manual trigger
release:
types: [created]

jobs:
publish-sardinecan:
runs-on: ubuntu-latest
publish-sardinecan:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v4

- name: Get version
run: |
echo "VERSION=$(cat VERSION.txt)" >> $GITHUB_ENV
- name: Get version
run: |
echo "VERSION=$(cat VERSION.txt)" >> $GITHUB_ENV
- name: Build the SardineCan Docker image
run: |
echo "Building SardineCan docker in ${{ env.VERSION }}"
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build --tag ghcr.io/merschformann/sardinecan:latest --tag ghcr.io/merschformann/sardinecan:${{ env.VERSION }} -f Dockerfile ..
docker push ghcr.io/merschformann/sardinecan:latest
docker push ghcr.io/merschformann/sardinecan:${{ env.VERSION }}
working-directory: ./SC.Service
- name: Build the SardineCan Docker image
run: |
echo "Building SardineCan docker in ${{ env.VERSION }}"
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build --tag ghcr.io/merschformann/sardinecan:latest --tag ghcr.io/merschformann/sardinecan:${{ env.VERSION }} -f Dockerfile ..
docker push ghcr.io/merschformann/sardinecan:latest
docker push ghcr.io/merschformann/sardinecan:${{ env.VERSION }}
working-directory: ./SC.Service
2 changes: 1 addition & 1 deletion SC.ExecutionHandler/Executor.cs → SC.CLI/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace SC.ExecutionHandler
namespace SC.CLI
{
/// <summary>
/// A class used to wrap the methods to enable execution by the CLI
Expand Down
4 changes: 2 additions & 2 deletions SC.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using SC.ObjectModel.IO;
using System;
using System.IO;
using SC.ExecutionHandler;
using SC.CLI;
using SC.ObjectModel.Additionals;
using SC.ObjectModel.Configuration;
using SC.ObjectModel.IO.Json;
Expand Down Expand Up @@ -34,7 +34,7 @@ private static void Execute(Options opts)

// >> Run calculation
Action<string> logger = string.IsNullOrWhiteSpace(opts.Output) ? null : Console.Write;
instance.Configuration ??= new Configuration(MethodType.ExtremePointInsertion, false);
instance.Configuration ??= new Configuration(MethodType.ExtremePointInsertion, true);
var result = Executor.Execute(Instance.FromJsonInstance(instance.Instance), instance.Configuration, logger);

// Output result
Expand Down
11 changes: 7 additions & 4 deletions SC.CLI/SC.CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SC.ExecutionHandler\SC.ExecutionHandler.csproj" />
<ProjectReference Include="..\SC.Heuristics\SC.Heuristics.csproj" />
<ProjectReference Include="..\SC.ObjectModel\SC.ObjectModel.csproj" />
<ProjectReference Include="..\SC.Linear\SC.Linear.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion SC.DataPreparation/DataProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SC.ExecutionHandler;
using SC.CLI;
using SC.ObjectModel.Additionals;
using System;
using System.Collections.Generic;
Expand Down
8 changes: 4 additions & 4 deletions SC.DataPreparation/SC.DataPreparation.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SC.ExecutionHandler\SC.ExecutionHandler.csproj" />
<ProjectReference Include="..\SC.CLI\SC.CLI.csproj" />
<ProjectReference Include="..\SC.ObjectModel\SC.ObjectModel.csproj" />
</ItemGroup>

Expand Down
19 changes: 0 additions & 19 deletions SC.ExecutionHandler/Program.cs

This file was deleted.

16 changes: 0 additions & 16 deletions SC.ExecutionHandler/SC.ExecutionHandler.csproj

This file was deleted.

5 changes: 3 additions & 2 deletions SC.GUI/SC.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<UseWPF>true</UseWPF>
<ApplicationIcon>Logo.ico</ApplicationIcon>
<Platforms>x64;x86</Platforms>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SC.Heuristics/SC.Heuristics.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SC.Linear/SC.Linear.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions SC.ObjectModel/COSolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,10 @@ public JsonSolution ToJsonSolution()
{
Containers = InstanceLinked.Containers.Select(c => new JsonSolutionContainer()
{
ID = c.ID,
Length = c.Mesh.Length,
Width = c.Mesh.Width,
Height = c.Mesh.Height,
Assignments = ContainerContent[c.VolatileID].Select(p => new JsonAssignment()
{
Piece = p.ID,
Expand All @@ -1483,6 +1487,15 @@ public JsonSolution ToJsonSolution()
B = RotationMatrices.GetRotationAngles(Orientations[p.VolatileID]).beta,
C = RotationMatrices.GetRotationAngles(Orientations[p.VolatileID]).gamma,
},
Cubes = p[Orientations[p.VolatileID]].Components.Select(com => new JsonCube()
{
X = com.RelPosition.X,
Y = com.RelPosition.Y,
Z = com.RelPosition.Z,
Length = com.Length,
Width = com.Width,
Height = com.Height,
}).ToList(),
}).ToList(),
}).ToList(),
Offload = OffloadPieces.Select(p => p.ID).ToList(),
Expand Down
2 changes: 2 additions & 0 deletions SC.ObjectModel/IO/Json/JsonAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public class JsonAssignment
public int Piece { get; set; }
[JsonPropertyName("position")]
public JsonPosition Position { get; set; }
[JsonPropertyName("cubes")]
public List<JsonCube> Cubes { get; set; }
}
}
8 changes: 8 additions & 0 deletions SC.ObjectModel/IO/Json/JsonSolutionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ namespace SC.ObjectModel.IO.Json
{
public class JsonSolutionContainer
{
[JsonPropertyName("id")]
public int ID { get; set; }
[JsonPropertyName("length")]
public double Length { get; set; }
[JsonPropertyName("width")]
public double Width { get; set; }
[JsonPropertyName("height")]
public double Height { get; set; }
[JsonPropertyName("assignments")]
public List<JsonAssignment> Assignments { get; set; }
}
Expand Down
4 changes: 2 additions & 2 deletions SC.ObjectModel/SC.ObjectModel.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions SC.Playground/SC.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SC.ExecutionHandler\SC.ExecutionHandler.csproj" />
<ProjectReference Include="..\SC.Heuristics\SC.Heuristics.csproj" />
<ProjectReference Include="..\SC.ObjectModel\SC.ObjectModel.csproj" />
<ProjectReference Include="..\SC.Service\SC.Service.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions SC.Service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["SC.Service/SC.Service.csproj", "SC.Service/"]
RUN dotnet restore "SC.Service/SC.Service.csproj"
Expand Down
2 changes: 1 addition & 1 deletion SC.Service/Elements/JobManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
using SC.ExecutionHandler;
using SC.CLI;
using SC.ObjectModel;
using SC.ObjectModel.Additionals;
using SC.ObjectModel.IO.Json;
Expand Down
6 changes: 3 additions & 3 deletions SC.Service/SC.Service.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<Platforms>x64;x86</Platforms>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SC.ExecutionHandler\SC.ExecutionHandler.csproj" />
<ProjectReference Include="..\SC.CLI\SC.CLI.csproj" />
<ProjectReference Include="..\SC.ObjectModel\SC.ObjectModel.csproj" />
<ProjectReference Include="..\SC.Toolbox\SC.Toolbox.csproj" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SC.Toolbox/SC.Toolbox.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64;x86</Platforms>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.6</Version>
<SelfContained>true</SelfContained>
</PropertyGroup>

</Project>
Loading

0 comments on commit fa7ccc7

Please sign in to comment.