Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
spuder committed Nov 21, 2024
1 parent 35f63eb commit fce3f1b
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 113 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/contributors.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
on:
push:
branches:
- main

push:
branches:
- main
jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
permissions:
contents: write
pull-requests: write
steps:
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
permissions:
contents: write
pull-requests: write
steps:
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 13 additions & 15 deletions .github/workflows/pages-version.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
---
name: Update Documentation Version
on:
push:
branches: ["main"]
paths:
- 'artifacts/manifest.json'

jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}

token: ${{ secrets.PAT }}
# Replace the badge with the latest version
# https://img.shields.io/badge/esp32s2-0.1.0-magenta
- name: Read manifest and update docs
run: |
# Read version from manifest.json
VERSION=$(jq -r .version artifacts/manifest.json)
echo "VERSION=$VERSION"
sed -i 's/badge\/openspool-[^-]*-magenta/badge\/openspool-'"$VERSION"'-magenta/' docs/index.md
sed -i 's/badge\/openspool-[^-]*-magenta/badge\/openspool-'"$VERSION"'-magenta/' README.md
echo "docs/index.md"
cat docs/index.md | grep shields.io
echo "README.md"
cat README.md | grep shields.io
# Read version from manifest.json
VERSION=$(jq -r .version artifacts/manifest.json)
echo "VERSION=$VERSION"
sed -i 's/badge\/openspool-[^-]*-magenta/badge\/openspool-'"$VERSION"'-magenta/' docs/index.md
sed -i 's/badge\/openspool-[^-]*-magenta/badge\/openspool-'"$VERSION"'-magenta/' README.md
echo "docs/index.md"
cat docs/index.md | grep shields.io
echo "README.md"
cat README.md | grep shields.io
- name: Commit manifest file
uses: EndBug/add-and-commit@v9
with:
committer_name: GitHub Actions
committer_email: [email protected]
committer_email: [email protected]
message: Update manifest.json
add: "docs/*.md README.md"
push: true
push: true
17 changes: 5 additions & 12 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
---
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: OpenSpool.io Docs

on:
push:
branches: ["main"]
paths:
- "docs/**"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -43,7 +39,6 @@ jobs:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
working-directory: '${{ github.workspace }}/docs'

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
Expand All @@ -56,9 +51,7 @@ jobs:
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3
with:
path: "docs/_site/"


path: "docs/_site/"
# Deployment job
deploy:
environment:
Expand All @@ -69,4 +62,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
repos:
- repo: https://github.com/google/yamlfmt
rev: v0.10.0
hooks:
- id: yamlfmt
# yamllint has trouble with scalars like '- lambda: |- '
# - repo: https://github.com/google/yamlfmt
# rev: v0.10.0
# hooks:
# - id: yamlfmt
- repo: local
hooks:
- id: esphome-config-solo
name: ESPHome Compile Solo
entry: bash -c 'podman run -v "$(pwd)/firmware:/data" --rm ghcr.io/esphome/esphome:2024.11.0 config /data/config-solo.yaml'
language: system
pass_filenames: false
files: ^firmware/
- id: esphome-config-ams
name: ESPHome Compile AMS
entry: bash -c 'podman run -v "$(pwd)/firmware:/data" --rm ghcr.io/esphome/esphome:2024.11.0 config /data/config-ams.yaml'
language: system
pass_filenames: false
files: ^firmware/
8 changes: 8 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
formatter:
indent: 2
line_ending: lf
include_document_start: true
colons: align
scan_folded_as_literal: true
disallow_anchors: false
retain_line_breaks: true
16 changes: 4 additions & 12 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
---
title: OpenSpool
description: Your filament wants to be free
theme: just-the-docs

url: https://openspool.io

aux_links:
"Edit this page on Github":
"Edit this page on Github":
- https://github.com/spuder/openspool

logo: "images/OpenSpoolLogoMedium1.png"

favicon: "images/favicon.ico"

color_scheme: dark

plugins:
- jekyll-default-layout

head_scripts:
# https://github.com/esphome/esp-web-tools/issues/515#issuecomment-2387664391
# - https://unpkg.com/@improv-wifi/[email protected]/dist/serial.min.js?module
Expand All @@ -27,12 +21,11 @@ defaults:
path: "assets/js"
values:
js: true

callouts:
warning:
title: Warning
color: red
note:
note:
title: Note
color: blue
important:
Expand All @@ -42,7 +35,6 @@ callouts:
title: Caution
color: yellow


# footer_content: "Copyright &copy; 2017-2020 Patrick Marsceill. Distributed by an <a href=\"https://github.com/just-the-docs/just-the-docs/tree/main/LICENSE.txt\">MIT license.</a>"

# # Footer "Edit this page on GitHub" link text
Expand All @@ -51,4 +43,4 @@ callouts:
# gh_edit_repository: "https://github.com/just-the-docs/just-the-docs" # the github URL for your repo
# gh_edit_branch: "main" # the branch that your docs is served from
# # gh_edit_source: docs # the source that your files originate from
# gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately
# gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately
1 change: 1 addition & 0 deletions firmware/common.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
substitutions:
name: openspool
version: "0.0.0" # Keep this at 0.0.0 as github-actions will modify this file at build time
Expand Down
5 changes: 3 additions & 2 deletions firmware/conf.d/automation.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
script:
- id: preview_rfid_data
then:
Expand All @@ -7,7 +8,7 @@ script:
auto pretty_json = [=]() -> std::string {
StaticJsonDocument<256> doc;
JsonObject root = doc.to<JsonObject>();
root["protocol"] = "openspool";
root["version"] = "1.0";
root["brand"] = id(filament_brand).state.c_str();
Expand Down Expand Up @@ -82,7 +83,7 @@ script:
} else {
return true;
}
# TODO: Check if mqtt is enabled once this is merged: https://github.com/esphome/esphome/pull/7716
# TODO: Check if mqtt is enabled once this is merged: https://github.com/esphome/esphome/pull/7716
then:
- mqtt.publish:
# topic: device/${bambu_serial_number}/request
Expand Down
1 change: 1 addition & 0 deletions firmware/conf.d/bambu_printer.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
select:
#TODO: printer model is currently unused, but will be needed for setting AMS type
- platform: template
Expand Down
1 change: 1 addition & 0 deletions firmware/conf.d/button.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
binary_sensor:
- platform: gpio
id: physical_button
Expand Down
6 changes: 1 addition & 5 deletions firmware/conf.d/debug.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
# NOTE None of these metrics are available until device is connected to MQTT
# This feels like a bug, but not sure why

debug:
update_interval: 5s

logger:
level: debug
logs:
Expand All @@ -17,7 +16,6 @@ text_sensor:
# state_topic:
# # web_server:
# # sorting_group_id: sorting_group_info

- platform: template
name: "OpenSpool Version"
lambda: |-
Expand All @@ -26,15 +24,13 @@ text_sensor:
icon: mdi:new-box
web_server:
sorting_group_id: sorting_group_info

- platform: debug
# device:
# name: "Device Info"
# state_topic:
reset_reason:
name: "Reset Reason"
state_topic:

sensor:
- platform: debug
free:
Expand Down
10 changes: 1 addition & 9 deletions firmware/conf.d/filament.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Bambu Filament mappings
# Credit to WolfWithSword for figuring all these out
# https://gist.github.com/WolfwithSword/e3e4dc4f00629cc047b7cefd70d7b350#file-bambu_mqtt-json-L314
Expand All @@ -24,7 +25,6 @@ select:
- script.execute: generate_filament_brand_code
- script.execute: generate_filament_temperatures
- script.execute: preview_rfid_data

- platform: template
name: "Filament Variant"
id: filament_variant
Expand All @@ -45,7 +45,6 @@ select:
- script.execute: generate_filament_brand_code
- script.execute: preview_rfid_data
- script.execute: generate_filament_temperatures #TODO: not fully implemented for variants yet

- platform: template
name: "Filament Brand"
id: filament_brand
Expand Down Expand Up @@ -162,7 +161,6 @@ select:
return "";
}
- script.execute: preview_rfid_data

number:
- platform: template
name: "Filament Min Temp"
Expand All @@ -186,7 +184,6 @@ number:
on_value:
then:
- script.execute: preview_rfid_data

- platform: template
name: "Filament Max Temp"
id: filament_max_temp
Expand All @@ -210,7 +207,6 @@ number:
on_value:
then:
- script.execute: preview_rfid_data

text_sensor:
- platform: template
name: "Filament Brand Code"
Expand All @@ -222,7 +218,6 @@ text_sensor:
on_value:
then:
- script.execute: preview_rfid_data

- platform: template
name: "Filament Color Hex"
id: filament_color_hex
Expand All @@ -239,7 +234,6 @@ text_sensor:
id(filament_color_hex_bambu).publish_state("");
}
- script.execute: preview_rfid_data

- platform: template
name: "Filament Color Hex Bambu"
id: filament_color_hex_bambu
Expand All @@ -250,7 +244,6 @@ text_sensor:
on_value:
then:
- script.execute: preview_rfid_data

- platform: template
name: Filament Sub Brand
id: filament_sub_brand
Expand All @@ -261,7 +254,6 @@ text_sensor:
on_value:
then:
- script.execute: preview_rfid_data

button:
- platform: template
id: upload_filament_settings
Expand Down
3 changes: 2 additions & 1 deletion firmware/conf.d/improv.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
improv_serial:
# next_url: "http://{{ip_address}}"
# next_url: "http://{{ip_address}}"
Loading

0 comments on commit fce3f1b

Please sign in to comment.