Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4e0ed93
Merge pull request #7 from JosunLP/dev
JosunLP Oct 29, 2025
7ce7ce8
Initial plan
Copilot Oct 30, 2025
a5c909b
Add native macOS support for builds and releases
Copilot Oct 30, 2025
cca113d
Refactor: consolidate Unix installation logic for Linux and macOS
Copilot Oct 30, 2025
f5e4143
🐛 Korrigiere SHA256-Checksumme für Linux und macOS; füge Fehlerausgab…
JosunLP Nov 1, 2025
f28bd5c
🐛 Verbessere Fehlerausgabe für nicht unterstützte macOS-Architekturen
JosunLP Nov 1, 2025
c3aba12
Merge branch 'copilot/add-macos-support-release' into dev
JosunLP Nov 2, 2025
45bc16f
Feature: Rotation (#11)
JosunLP Dec 4, 2025
83e4149
Add Docker deployment target with automated Docker Hub publishing (#13)
Copilot Dec 5, 2025
3d4eaf8
Potential fix for code scanning alert no. 1: Workflow does not contai…
JosunLP Dec 5, 2025
4d3f253
Update src/api.rs
JosunLP Dec 5, 2025
f2a0196
Add conditional checks to Docker workflow for missing secrets (#18)
Copilot Dec 5, 2025
c2bbf65
Revert invalid secret conditionals in Docker workflow (#19)
Copilot Dec 5, 2025
77f1116
Add unit tests for parse_bool and clarify allow_rotations API fallbac…
Copilot Dec 8, 2025
fc9635f
fmt
JosunLP Dec 11, 2025
3a956b4
Update dependencies and improve API route handling
JosunLP Dec 11, 2025
95ba14b
Update version to 1.1.0 and enhance Docker setup documentation
JosunLP Dec 11, 2025
37feb52
Refine Docker configuration and clarify axum 0.8 route syntax (#23)
Copilot Dec 12, 2025
5d63499
Add test coverage for allow_rotations field parsing and override beha…
Copilot Dec 12, 2025
fee94cd
Update CHANGELOG
JosunLP Dec 12, 2025
7bb3420
Update CHANGELOG
JosunLP Dec 12, 2025
43adef1
Merge remote-tracking branch 'origin/main' into dev
JosunLP Dec 13, 2025
66a1a70
Fix Docker container startup with ENTRYPOINT (#25)
Copilot Dec 14, 2025
e468f65
Refactor: Update German language strings to English in update.rs, ind…
JosunLP Dec 14, 2025
6c29f00
Dokumentation: Ergänze Anweisungen zu Kernarten und deren Verwendung …
JosunLP Dec 14, 2025
0ac09f3
Bump version to 1.2.0 in Cargo.toml and package.json
JosunLP Dec 14, 2025
faf5806
Refactor: Optimize string formatting in update.rs and optimizer.rs
JosunLP Dec 14, 2025
070236d
Dokumentation: Aktualisiere Kommentare und Übersetzungen in docker-co…
JosunLP Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
741 changes: 741 additions & 0 deletions .github/copilot-instructions.md

Large diffs are not rendered by default.

33 changes: 31 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,27 @@ on:

permissions:
contents: read
security-events: write

jobs:
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Validate required secrets
run: |
if [ -z "${{ secrets.DOCKER_USERNAME }}" ] || [ -z "${{ secrets.DOCKER_PASSWORD }}" ]; then
echo "::error::Missing required secrets DOCKER_USERNAME or DOCKER_PASSWORD"
echo "Please configure these secrets in Settings → Secrets and variables → Actions"
exit 1
fi

- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -26,7 +38,6 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Note: Ensure DOCKER_USERNAME and DOCKER_PASSWORD secrets are configured

- name: Extract metadata for Docker
id: meta
Expand All @@ -41,7 +52,7 @@ jobs:
type=raw,value=dev,enable=${{ github.event_name == 'workflow_dispatch' }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand All @@ -50,3 +61,21 @@ jobs:
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: true
sbom: true

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
with:
# Use the first tag from metadata-action (e.g., "user/repo:1.2.3")
image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
ignore-unfixed: true

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: "trivy-results.sarif"
33 changes: 33 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## [1.2.0] - 2025-12-14

### Added

- New `types.rs` module with reusable core types following OOP and DRY principles:
- `Vec3` - 3D vector type with operator overloading (+, -, \*)
- `BoundingBox` - Axis-Aligned Bounding Box for collision detection
- `Dimensional`, `Positioned`, `Weighted` traits for polymorphism
- `CenterOfMassCalculator` for weighted center of mass calculations
- `EPSILON_GENERAL` and `EPSILON_HEIGHT` constants
- Validation functions (`validate_dimension`, `validate_weight`, `validate_dimensions_3d`)

### Changed

- Refactored `model.rs` to implement traits from `types.rs`:
- `Box3D` implements `Dimensional`, `Weighted`
- `PlacedBox` implements `Positioned`, `Dimensional`, `Weighted`
- `Container` implements `Dimensional`
- Improved `geometry.rs` to use `BoundingBox` for calculations
- Translated entire project from German to English:
- All Rust source files (8 files)
- Documentation (README.md, CONCEPT.md, DOCKER_SETUP.md)
- Copilot instructions (.github/copilot-instructions.md)
- Installation scripts (install-unix.sh, install-windows.ps1)
- Web frontend (index.html, script.js)
- Updated copilot-instructions.md with comprehensive documentation

### Improved

- Code organization following OOP and DRY principles
- Test coverage increased to 42 tests across all modules
- Better separation of concerns with trait-based design

## [1.1.2] - 2025-12-12

- Minor fix in the windows installation script.
Expand Down
42 changes: 21 additions & 21 deletions CONCEPT.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Box Packing Konzept
# Box Packing Concept

## Parameter
## Parameters

Quader sollen möglichst effizient in einem Quader verpackt werden.
Cuboids should be packed as efficiently as possible into a cuboid container.

## Relevante Werte
## Relevant Values

Maximalgewicht Verpackung.
Gewicht Einzelobjekte.
Abmessung (3d) Verpackung.
Abmessung (3d) Einzelobjekte.
Mehrere Verpackungstypen mit individuellen Dimensionen und Gewichtslimits.
Maximum container weight.
Individual object weights.
Container dimensions (3D).
Individual object dimensions (3D).
Multiple container types with individual dimensions and weight limits.

## Ziel
## Goal

Algorithmische Lösung.
Bei zu geringem Volumen oder Grundfläche der Verpackung sollen die Objekte entsprechend in mehreren Verpackungen der angegebenen Größe möglichst effizient verpackt werden.
Algorithmic solution.
If container volume or base area is insufficient, objects should be packed efficiently across multiple containers of the specified sizes.

Entsprechend muss dann auch der Algorithmus mehrfach ausgeführt werden, bis alle Objekte verpackt sind.
Zudem kann der Algorithmus unterschiedliche Verpackungstypen kombinieren, um den Bedarf bestmöglich abzudecken.
Accordingly, the algorithm must be executed multiple times until all objects are packed.
Additionally, the algorithm can combine different container types to best meet requirements.

Schwere Objekte müssen immer unter leichteren Objekten sein, das Gewicht muss ebenfalls gleichmäßig auf der Grundfläche verteilt werden
Heavy objects must always be below lighter objects, and weight must be evenly distributed across the base area.

Große objekte nach möglichkeit nach unten. Die grundfläche soll möglichst gleichmäßig mit gewicht belastet sein und möglichst gleichmäßig mit objekten gefüllt sein. Es dürfen keine Objekte überhängen, so dass sie herunterfallen könnten.
Large objects should preferably be placed at the bottom. The base area should be loaded as evenly as possible with weight and filled as uniformly as possible with objects. Objects must not overhang in a way that would cause them to fall.

Am ende sollen die Objekte möglichst raumfüllend und kompackt gepackt sein.
In the end, objects should be packed as space-filling and compact as possible.

Objekte können nicht gedreht werden.
Objects cannot be rotated.

## Tech Basis
## Tech Stack

Rust Konsolen App mit andauernder Laufzeit und ansprechbaren Schnittstellen
Rust console application with persistent runtime and accessible interfaces

3D-Geometrische Heuristik in Kombination mit Gewichtsverteilung und Schichtung
3D geometric heuristic combined with weight distribution and layering
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sort_it_now"
version = "1.1.2"
version = "1.2.0"
edition = "2024"
license = "LicenseRef-NCSL-1.0"

Expand All @@ -26,3 +26,8 @@ utoipa = { version = "5.4", features = ["axum_extras"] }

[target.'cfg(windows)'.dependencies]
winreg = "0.52"

[profile.release]
lto = true
codegen-units = 1
strip = true
120 changes: 60 additions & 60 deletions DOCKER_SETUP.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
# Docker Hub Deployment Setup

Diese Anleitung beschreibt, wie man die automatische Docker-Veröffentlichung auf Docker Hub einrichtet.
This guide describes how to set up automatic Docker publishing to Docker Hub.

## Voraussetzungen
## Prerequisites

1. Ein Docker Hub Account (<https://hub.docker.com/>)
2. Repository-Admin-Zugriff auf GitHub
1. A Docker Hub account (<https://hub.docker.com/>)
2. Repository admin access on GitHub

## Schritt 1: Docker Hub Access Token erstellen
## Step 1: Create Docker Hub Access Token

1. Gehe zu <https://hub.docker.com/settings/security>
2. Klicke auf "New Access Token"
3. Gib einen Namen ein (z.B. "github-actions-sort-it-now")
4. Wähle die Berechtigung "Read, Write" aus
5. Klicke auf "Generate"
6. **Wichtig:** Kopiere das Token sofort - es wird nur einmal angezeigt!
1. Go to <https://hub.docker.com/settings/security>
2. Click "New Access Token"
3. Enter a name (e.g., "github-actions-sort-it-now")
4. Select "Read, Write" permission
5. Click "Generate"
6. **Important:** Copy the token immediately - it will only be shown once!

## Schritt 2: GitHub Secrets konfigurieren
## Step 2: Configure GitHub Secrets

1. Gehe zu deinem GitHub Repository
2. Navigiere zu **Settings** → **Secrets and variables** → **Actions**
3. Klicke auf "New repository secret"
4. Erstelle zwei Secrets:
1. Go to your GitHub repository
2. Navigate to **Settings** → **Secrets and variables** → **Actions**
3. Click "New repository secret"
4. Create two secrets:

**Secret 1:**

- Name: `DOCKER_USERNAME`
- Value: Dein Docker Hub Benutzername
- Value: Your Docker Hub username

**Secret 2:**

- Name: `DOCKER_PASSWORD`
- Value: Das Access Token aus Schritt 1
- Value: The access token from Step 1

## Schritt 3: Workflow testen
## Step 3: Test the Workflow

Der Docker-Workflow wird automatisch ausgelöst, wenn:
The Docker workflow is automatically triggered when:

- Ein neuer Tag im Format `v*` erstellt wird (z.B. `v1.1.0`)
- Der Workflow manuell über "Actions" → "Docker Build and Push" → "Run workflow" gestartet wird
- A new tag in the format `v*` is created (e.g., `v1.1.0`)
- The workflow is manually started via "Actions" → "Docker Build and Push" → "Run workflow"

### Manueller Test
### Manual Test

1. Gehe zu **Actions** im GitHub Repository
2. Wähle den Workflow "Docker Build and Push"
3. Klicke auf "Run workflow"
4. Wähle den Branch aus
5. Klicke auf "Run workflow"
1. Go to **Actions** in the GitHub repository
2. Select the workflow "Docker Build and Push"
3. Click "Run workflow"
4. Select the branch
5. Click "Run workflow"

## Schritt 4: Docker Image auf Docker Hub verifizieren
## Step 4: Verify Docker Image on Docker Hub

Nach erfolgreichem Workflow-Durchlauf:
After successful workflow completion:

1. Gehe zu <https://hub.docker.com/>
2. Navigiere zu deinem Repository
3. Das Image sollte mit den entsprechenden Tags verfügbar sein:
- `latest` (wird bei jedem Release mit einem `v*` Tag vergeben)
- Versions-Tags (z.B. `1.0.0`, `1.0`, `1`)
1. Go to <https://hub.docker.com/>
2. Navigate to your repository
3. The image should be available with the corresponding tags:
- `latest` (assigned with each release having a `v*` tag)
- Version tags (e.g., `1.0.0`, `1.0`, `1`)

## Docker Image verwenden
## Using the Docker Image

Nach der Veröffentlichung kann das Image folgendermaßen verwendet werden:
After publishing, the image can be used as follows:

> **Hinweis:** Ersetze `<your-dockerhub-username>` durch deinen tatsächlichen Docker Hub Benutzernamen.
> **Note:** Replace `<your-dockerhub-username>` with your actual Docker Hub username.

```bash
# Neueste Version
# Latest version
docker pull <your-dockerhub-username>/sort-it-now:latest

# Spezifische Version
# Specific version
docker pull <your-dockerhub-username>/sort-it-now:1.0.0

# Ausführen
# Run
docker run -p 8080:8080 -e SORT_IT_NOW_SKIP_UPDATE_CHECK=1 <your-dockerhub-username>/sort-it-now:latest
```

## Troubleshooting

### Workflow schlägt mit "Authentication failed" fehl
### Workflow fails with "Authentication failed"

- Überprüfe, ob die Secrets korrekt gesetzt sind
- Stelle sicher, dass das Docker Hub Access Token nicht abgelaufen ist
- Verifiziere den Docker Hub Benutzernamen (Groß-/Kleinschreibung beachten)
- Check if the secrets are set correctly
- Ensure the Docker Hub access token has not expired
- Verify the Docker Hub username (case-sensitive)

### Workflow schlägt mit "denied: requested access to the resource is denied" fehl
### Workflow fails with "denied: requested access to the resource is denied"

- Das Access Token benötigt "Write"-Berechtigung
- Stelle sicher, dass das Repository auf Docker Hub existiert (wird automatisch beim ersten Push erstellt)
- The access token needs "Write" permission
- Ensure the repository exists on Docker Hub (automatically created on first push)

### Image wird nicht mit allen Plattformen gebaut
### Image is not built for all platforms

- Docker Buildx wird automatisch eingerichtet
- Bei Problemen kann man in `.github/workflows/docker.yml` die Zeile `platforms: linux/amd64,linux/arm64` auf nur `linux/amd64` reduzieren
- Docker Buildx is automatically set up
- If there are issues, you can reduce the line `platforms: linux/amd64,linux/arm64` in `.github/workflows/docker.yml` to just `linux/amd64`

## Anpassungen
## Customizations

### Docker Hub Repository-Name ändern
### Change Docker Hub Repository Name

In `.github/workflows/docker.yml` die Zeile:
In `.github/workflows/docker.yml`, change the line:

```yaml
images: ${{ secrets.DOCKER_USERNAME }}/sort-it-now
```

ändern zu:
to:

```yaml
images: ${{ secrets.DOCKER_USERNAME }}/dein-repository-name
images: ${{ secrets.DOCKER_USERNAME }}/your-repository-name
```

### Andere Registry verwenden (z.B. GitHub Container Registry)
### Use Different Registry (e.g., GitHub Container Registry)

Für GitHub Container Registry (ghcr.io):
For GitHub Container Registry (ghcr.io):

1. Ersetze `docker/login-action` mit GitHub Token:
1. Replace `docker/login-action` with GitHub Token:

```yaml
- name: Log in to GitHub Container Registry
Expand All @@ -124,7 +124,7 @@ Für GitHub Container Registry (ghcr.io):
password: ${{ secrets.GITHUB_TOKEN }}
```

2. Ändere das Image in `metadata-action`:
2. Change the image in `metadata-action`:

```yaml
images: ghcr.io/${{ github.repository_owner }}/sort-it-now
Expand Down
Loading