Skip to content

Commit

Permalink
Merge branch 'main' into pr_test_3
Browse files Browse the repository at this point in the history
  • Loading branch information
FHeilmann committed Jan 4, 2024
2 parents cf60802 + 0728b6a commit 0125919
Show file tree
Hide file tree
Showing 23 changed files with 509 additions and 196 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.tag_version.outputs.new_tag }}
type=raw,value=latest
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},value=${{ steps.tag_version.outputs.new_version }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ steps.tag_version.outputs.new_version }}
type=semver,pattern=v{{major}},value=${{ steps.tag_version.outputs.new_version }}
- name: Build and push Docker image
if: ${{ steps.tag_version.outputs.new_tag != steps.tag_version.outputs.previous_tag }}
uses: docker/build-push-action@v5
Expand All @@ -54,6 +55,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
TOOLKIT_VERSION=${{ steps.tag_version.outputs.new_version }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/test_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ jobs:
id: sanitize_file_list
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
FILE_LIST_SANITIZE_INPUT: ${{ steps.list_files.outputs.FILE_LIST }}
SPARSE_CHECKOUT_HELPER_INPUT: ${{ steps.list_files.outputs.FILE_LIST }}
with:
args: sanitize-file-list
# Run whitespace checks based on files in the test directory
- name: Whitespace Checker
args: prepare-sparse-checkout
# Run file checks based on files in the test directory
- name: File Checker
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
WHITESPACE_CHECKER_IGNORE_WARNINGS: false
FILE_CHECKER_IGNORE_WARNINGS: true
FILE_CHECKER_CHECK_LICENSE: true
FILE_CHECKER_CHECK_FILE_SIZE_MB: 2
with:
args: check-whitespace
args: check-files
- name: Mod Structure Checker
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/test_generate_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: voronusers_ci_push_main
on:
workflow_dispatch:
jobs:
generate_readme:
runs-on: ubuntu-latest
steps:
# Perform a sparse checkout, checking out only yaml files and the current README.md
- name: Perform Sparse Checkout ↪️
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
ref: ${{ github.ref }}
sparse-checkout: |
tests/test_repository_root/printer_mods/**/.metadata.yml
tests/test_repository_root/printer_mods/README.md
tests/test_repository_root/printer_mods/mods.json
fetch-depth: 0
token: ${{ secrets.VORON_BOT_GITHUB_PAT }}
sparse-checkout-cone-mode: false
# Generate the new readme file
- name: Generate README 📒
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
VORON_TOOLKIT_OUTPUT_DIR: _out
VORON_TOOLKIT_INPUT_DIR: tests/test_repository_root/printer_mods
VORON_TOOLKIT_VERBOSE: true
README_GENERATOR_MARKDOWN: true
README_GENERATOR_JSON: true
with:
args: generate-readme
# Commit the new readme using the GH bot credentials
- name: Commit files 💾
run: |
git config user.email "[email protected]"
git config user.name "Voron-GitHub-Bot"
tree -a _out
cp _out/readme_generator/README.md tests/test_repository_root/printer_mods/README.md
cp _out/readme_generator/mods.json tests/test_repository_root/printer_mods/mods.json
git add tests/test_repository_root/printer_mods/README.md tests/test_repository_root/printer_mods/mods.json
git commit -m "Generate VoronUsers printer_mods README.md [skip ci]" || true
# Push the changes
- name: Push changes ⬆️
uses: ad-m/github-push-action@d9117be7cad08757e9e906a1bcd1716d6b192db5
with:
github_token: ${{ secrets.VORON_BOT_GITHUB_PAT }}
branch: ${{ github.ref }}
23 changes: 13 additions & 10 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: VoronCI PR Test CI
run-name: "#${{github.event.number}} - ${{github.event.pull_request.title}}"
on:
pull_request:
types: [opened, reopened, synchronize]
types: [opened, reopened, synchronize, labeled]
jobs:
voron_ci:
if: ${{ contains( github.event.pull_request.labels.*.name, 'Ready for CI') }}
env:
VORON_TOOLKIT_OUTPUT_DIR: ${{ github.workspace }}/workflow_output
VORON_TOOLKIT_INPUT_DIR: ${{ github.workspace }}/tests/test_repository_root/printer_mods
Expand All @@ -19,33 +20,35 @@ jobs:
with:
separator: "\n"
# Sanitize the file list
- name: Sanitize file list 🧹
- name: Prepare Sparse Checkout 🧹
id: sanitize_file_list
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
FILE_LIST_SANITIZE_INPUT: ${{ steps.changed-files.outputs.all_changed_files }}
SPARSE_CHECKOUT_HELPER_INPUT: ${{ steps.changed-files.outputs.all_changed_files }}
with:
args: sanitize-file-list
args: prepare-sparse-checkout
- name: Perform sparse checkout ↪️
# Perform a sparse checkout, checking out only the files of the PR
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
ref: ${{ github.ref }}
path: ${{ github.workspace }}
sparse-checkout: ${{ steps.sanitize_file_list.outputs.FILE_LIST_SANITIZE_OUTPUT }}
sparse-checkout: ${{ steps.sanitize_file_list.outputs.SPARSE_CHECKOUT_HELPER_OUTPUT }}
sparse-checkout-cone-mode: false
- name: Store PR number 🔢
if: '!cancelled()'
run: |
mkdir -p ${{ env.VORON_TOOLKIT_OUTPUT_DIR }}
echo -n ${{ github.event.number }} > ${{ env.VORON_TOOLKIT_OUTPUT_DIR }}/pr_number.txt
# Run whitespace checks based on files in the test directory
- name: Check for whitespace in folders/filenames 🔍
# Run whitespace/licenses/file sizes based on files in the test directory
- name: Check files for whitespace/licenses/file sizes 🔍
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
WHITESPACE_CHECKER_IGNORE_WARNINGS: false
FILE_CHECKER_IGNORE_WARNINGS: true
FILE_CHECKER_CHECK_LICENSE: true
FILE_CHECKER_CHECK_FILE_SIZE_MB: 2
with:
args: check-whitespace
args: check-files
- name: Check correct mod/file structure 🔍
if: '!cancelled()'
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
Expand All @@ -58,7 +61,7 @@ jobs:
if: '!cancelled()'
uses: docker://ghcr.io/vorondesign/voron_toolkit_docker:latest
env:
CORRUPTION_CHECKER_IGNORE_WARNINGS: false
CORRUPTION_CHECKER_IGNORE_WARNINGS: true
with:
args: check-stl-corruption
# Run the rotation checker
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
- id: ruff-format
- id: ruff
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM python:3.11.6-slim as builder
ARG TOOLKIT_VERSION

FROM python:3.11.6-slim as builder
WORKDIR /app

RUN apt-get update && apt-get install -y build-essential libadmesh-dev
Expand All @@ -14,7 +15,6 @@ COPY voron_toolkit/ /app/voron_toolkit
RUN poetry install --only-root && rm ./pyproject.toml ./poetry.lock

FROM python:3.11.6-slim as test

WORKDIR /app

RUN pip install poetry==1.7.0
Expand All @@ -24,7 +24,8 @@ RUN poetry install --only dev
RUN poetry run ruff voron_toolkit/ && poetry run ruff format --check voron_toolkit/ && poetry run mypy voron_toolkit

FROM python:3.11.6-slim as final

ARG TOOLKIT_VERSION
ENV VORON_TOOLKIT_VERSION=${TOOLKIT_VERSION}
WORKDIR /github/workspace
ADD https://github.com/unlimitedbacon/stl-thumb/releases/download/v0.5.0/stl-thumb_0.5.0_amd64.deb /tmp
RUN apt-get update && \
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo -e "\033[1;91m #############"
echo -e "\033[1;91m #######"
echo -e "\033[1;91m #"
echo -e "\033[39m"
echo " Welcome to the VoronDesign Toolkit docker container!"
echo " Welcome to the VoronDesign Toolkit docker container (v${VORON_TOOLKIT_VERSION})!"
echo " If you encounter any issues, please report them to the VoronDesign team!"
echo ""

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ ignore_missing_imports = true
check-mod-structure = "voron_toolkit.tools.mod_structure_checker:main"
check-stl-corruption = "voron_toolkit.tools.stl_corruption_checker:main"
check-stl-rotation = "voron_toolkit.tools.stl_rotation_checker:main"
check-whitespace = "voron_toolkit.tools.whitespace_checker:main"
debug-container = "voron_toolkit.utils.debug_container:print_container_info"
check-files = "voron_toolkit.tools.file_checker:main"
generate-readme = "voron_toolkit.tools.readme_generator:main"
sanitize-file-list = "voron_toolkit.utils.file_helper:sanitize_file_list"
set-pr-comment-labels = "voron_toolkit.utils.pr_helper:main"
prepare-sparse-checkout = "voron_toolkit.voronuser_utils.sparse_checkout_helper:main"
set-pr-comment-labels = "voron_toolkit.voronuser_utils.pr_helper:main"
upload-images = "voron_toolkit.utils.imagekit_uploader:main"
sanitize-file-list = "voron_toolkit.utils.file_helper:FileHelper.sanitize_file_list"
17 changes: 17 additions & 0 deletions tests/test_repository_root/printer_mods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Mods

Printer mods for Voron 3D printers
---



| Creator | Mod title | Description | Printer compatibility | Last Changed |
| --- | --- | --- | --- | --- |
| 1-0-R | [V2.4 handle](1-0-R/handle) | Handle for Voron 2.4 | V2.4 | 2023-12-10T23:01:31+00:00 |
| 120decibell | [Side entry exhaust housing](120decibell/exhaust_housing_side_entry) | Exhaust housing with dual cover screws and single or dual side... | V1.8, V2.4, VT | 2023-12-10T23:01:31+00:00 |
| | [Huvud Chain Mount](120decibell/huvud_chain_mount) | Huvud rear mount for Clockwork or LGX that supports a cable chain. | V1.8, VT | 2023-12-10T23:01:31+00:00 |
| aeresov | [MeanWell UHP-xxx DIN mount](aeresov/MeanWell_UHP_DIN_mount) | A bracket for MeanWell UHP series PSU (200, 350 and 500) to mount... | V2.4 | 2023-12-10T23:01:31+00:00 |
| | [Raspberry Pi DIN mount](aeresov/Raspberry_Pi_DIN_mount) | A bracket for Raspberry Pi 3/4 to mount it onto DIN rail, along or... | V2.4 | 2023-12-10T23:01:31+00:00 |
| | [SKR 1.3/1.4 DIN mount](aeresov/SKR_DIN_mount) | A bracket for SKR 1.3/1.4 board to mount it onto DIN rail, along or... | V2.4 | 2023-12-10T23:01:31+00:00 |
| | [TL filament sensor bracket](aeresov/TL_filament_sensor_bracket) | A bracket for TL filament sensor to mount near stock spool holder. | V2.4 | 2023-12-10T23:01:31+00:00 |
| | [cable tie DIN mount](aeresov/cable_tie_DIN_mount) | A bracket for cable ties to route cables across DIN rails. | V2.4 | 2023-12-10T23:01:31+00:00 |
66 changes: 66 additions & 0 deletions tests/test_repository_root/printer_mods/mods.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"path": "1-0-R/handle",
"title": "V2.4 handle",
"creator": "1-0-R",
"description": "Handle for Voron 2.4",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "120decibell/exhaust_housing_side_entry",
"title": "Side entry exhaust housing",
"creator": "120decibell",
"description": "Exhaust housing with dual cover screws and single or dual side entry filament paths.",
"printer_compatibility": "V1.8, V2.4, VT",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "120decibell/huvud_chain_mount",
"title": "Huvud Chain Mount",
"creator": "120decibell",
"description": "Huvud rear mount for Clockwork or LGX that supports a cable chain.",
"printer_compatibility": "V1.8, VT",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "aeresov/MeanWell_UHP_DIN_mount",
"title": "MeanWell UHP-xxx DIN mount",
"creator": "aeresov",
"description": "A bracket for MeanWell UHP series PSU (200, 350 and 500) to mount it across 2 DIN rails.",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "aeresov/Raspberry_Pi_DIN_mount",
"title": "Raspberry Pi DIN mount",
"creator": "aeresov",
"description": "A bracket for Raspberry Pi 3/4 to mount it onto DIN rail, along or across.",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "aeresov/SKR_DIN_mount",
"title": "SKR 1.3/1.4 DIN mount",
"creator": "aeresov",
"description": "A bracket for SKR 1.3/1.4 board to mount it onto DIN rail, along or across.",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "aeresov/TL_filament_sensor_bracket",
"title": "TL filament sensor bracket",
"creator": "aeresov",
"description": "A bracket for TL filament sensor to mount near stock spool holder.",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
},
{
"path": "aeresov/cable_tie_DIN_mount",
"title": "cable tie DIN mount",
"creator": "aeresov",
"description": "A bracket for cable ties to route cables across DIN rails.",
"printer_compatibility": "V2.4",
"last_changed": "2023-12-10T23:01:31+00:00"
}
]
8 changes: 6 additions & 2 deletions voron_toolkit/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
from collections import defaultdict
from dataclasses import dataclass
from enum import Enum
Expand All @@ -7,7 +8,10 @@
CI_PASSED_LABEL: str = "CI: Passed"
CI_FAILURE_LABEL: str = "CI: Issues identified"
CI_ERROR_LABEL: str = "Warning: CI Error"
READY_FOR_CI_LABEL: str = "Ready for CI"
PR_COMMENT_TAG: str = "<!-- voron_docker_toolkit -->"
PR_COMMENT_TOOLKIT_VERSION: str = f"<!-- Toolkit version {os.environ.get('VORON_TOOLKIT_VERSION', '<unknown>')} -->"
ALL_CI_LABELS: list[str] = [CI_PASSED_LABEL, CI_FAILURE_LABEL, CI_ERROR_LABEL, READY_FOR_CI_LABEL]


class ExtendedResult(NamedTuple):
Expand Down Expand Up @@ -112,11 +116,11 @@ class ToolIdentifierEnum(ToolIdentifier, Enum):
MOD_STRUCTURE_CHECK = ToolIdentifier(tool_id="mod_structure_check", tool_name="Mod structure checker")
README_GENERATOR = ToolIdentifier(tool_id="readme_generator", tool_name="Readme generator")
ROTATION_CHECK = ToolIdentifier(tool_id="rotation_check", tool_name="STL rotation checker")
WHITESPACE_CHECK = ToolIdentifier(tool_id="whitespace_check", tool_name="Whitespace checker")
FILE_CHECK = ToolIdentifier(tool_id="file_check", tool_name="File checker")


VORONUSERS_PR_COMMENT_SECTIONS: list[ToolIdentifierEnum] = [
ToolIdentifierEnum.WHITESPACE_CHECK,
ToolIdentifierEnum.FILE_CHECK,
ToolIdentifierEnum.MOD_STRUCTURE_CHECK,
ToolIdentifierEnum.CORRUPTION_CHECK,
ToolIdentifierEnum.ROTATION_CHECK,
Expand Down
Loading

0 comments on commit 0125919

Please sign in to comment.