Add validation
This commit is contained in:
32
.github/workflows/release_tag.yml
vendored
Normal file
32
.github/workflows/release_tag.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: Update Tags
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-tags:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
|
||||||
|
- name: Set up Git
|
||||||
|
run: |
|
||||||
|
git config --local user.email "action@github.com"
|
||||||
|
git config --local user.name "GitHub Action"
|
||||||
|
|
||||||
|
- name: Move and push stable tag
|
||||||
|
run: |
|
||||||
|
git tag -f stable ${{ github.event.release.tag_name }}
|
||||||
|
git push -f origin stable
|
||||||
|
|
||||||
|
- name: Move and push latest tag
|
||||||
|
run: |
|
||||||
|
git tag -f latest ${{ github.event.release.tag_name }}
|
||||||
|
git push -f origin latest
|
||||||
|
...
|
||||||
26
.github/workflows/validate_clang_format.yml
vendored
Normal file
26
.github/workflows/validate_clang_format.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: Validate C++ (Clang Format)
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**/*.h'
|
||||||
|
- '**/*.c'
|
||||||
|
- '**/*.cpp'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.h'
|
||||||
|
- '**/*.c'
|
||||||
|
- '**/*.cpp'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clang-format-checking:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@main
|
||||||
|
- uses: RafikFarhad/clang-format-github-action@v3
|
||||||
|
with:
|
||||||
|
sources: "components/tx_ultimate_easy/*.h,components/tx_ultimate_easy/*.cpp"
|
||||||
|
...
|
||||||
116
.github/workflows/validate_esphome.yml
vendored
Normal file
116
.github/workflows/validate_esphome.yml
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
---
|
||||||
|
name: Validate and Build ESPHome
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "*.yaml"
|
||||||
|
- "prebuilt/*.yaml"
|
||||||
|
- ".test/*.yaml"
|
||||||
|
- "*.h"
|
||||||
|
- "*.c"
|
||||||
|
- "*.cpp"
|
||||||
|
- "*.py"
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "*.yaml"
|
||||||
|
- "prebuilt/*.yaml"
|
||||||
|
- ".test/*.yaml"
|
||||||
|
- "*.h"
|
||||||
|
- "*.c"
|
||||||
|
- "*.cpp"
|
||||||
|
- "*.py"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup_dependencies:
|
||||||
|
name: Setup & Cache Dependencies
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
cache-hit-arduino: ${{ steps.cache-arduino.outputs.cache-hit }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Cache Arduino Dependencies
|
||||||
|
id: cache-arduino
|
||||||
|
uses: actions/cache@main
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.esphome/cache
|
||||||
|
~/.platformio/packages
|
||||||
|
~/.platformio/platforms
|
||||||
|
key: ${{ runner.os }}-arduino-${{ hashFiles('**/esphome_ard_basic.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-arduino-
|
||||||
|
|
||||||
|
code_scan:
|
||||||
|
name: Code scan (YAML)
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
needs: setup_dependencies
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@main
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
|
||||||
|
- name: Install Yamllint
|
||||||
|
run: pip install yamllint
|
||||||
|
|
||||||
|
- name: Validate YAML files
|
||||||
|
run: find . -name "*.yaml" -exec yamllint -c ./.rules/yamllint.yml {} +
|
||||||
|
|
||||||
|
build_basic:
|
||||||
|
name: Basic
|
||||||
|
needs: [code_scan, setup_dependencies]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- id: ard
|
||||||
|
yaml_file: ".test/esphome_ard_basic.yaml"
|
||||||
|
cache-hit: ${{ needs.setup_dependencies.outputs.cache-hit-arduino }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Firmware
|
||||||
|
if: steps.matrix.outputs.cache-hit != 'true'
|
||||||
|
uses: barndawgie/build-action@v1.9.0
|
||||||
|
with:
|
||||||
|
yaml_file: ${{ matrix.yaml_file }}
|
||||||
|
|
||||||
|
build_bluetooth_proxy:
|
||||||
|
name: Bluetooth Proxy
|
||||||
|
needs: build_basic
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- id: idf_v4
|
||||||
|
base: idf_v4
|
||||||
|
yaml_file: ".test/esphome_idf_bluetooth_proxy.yaml"
|
||||||
|
- id: idf_v5
|
||||||
|
base: idf_v5
|
||||||
|
yaml_file: ".test/esphome_idf5_bluetooth_proxy.yaml"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Build Bluetooth Proxy Firmware
|
||||||
|
uses: barndawgie/build-action@v1.9.0
|
||||||
|
with:
|
||||||
|
yaml_file: ${{ matrix.yaml_file }}
|
||||||
|
...
|
||||||
101
.github/workflows/validate_esphome_beta.yml
vendored
Normal file
101
.github/workflows/validate_esphome_beta.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
---
|
||||||
|
name: Validate ESPHome (Beta)
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup_dependencies:
|
||||||
|
name: Setup & Cache Dependencies
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
cache-hit-arduino: ${{ steps.cache-arduino.outputs.cache-hit }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Cache Arduino Dependencies
|
||||||
|
id: cache-arduino
|
||||||
|
uses: actions/cache@main
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.esphome/cache
|
||||||
|
~/.platformio/packages
|
||||||
|
~/.platformio/platforms
|
||||||
|
key: ${{ runner.os }}-arduino-${{ hashFiles('**/esphome_ard_basic.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-arduino-
|
||||||
|
|
||||||
|
code_scan:
|
||||||
|
name: Code scan (YAML)
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
needs: setup_dependencies
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@main
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
|
||||||
|
- name: Install Yamllint
|
||||||
|
run: pip install yamllint
|
||||||
|
|
||||||
|
- name: Validate YAML files
|
||||||
|
run: find . -name "*.yaml" -exec yamllint -c ./.rules/yamllint.yml {} +
|
||||||
|
|
||||||
|
build_basic:
|
||||||
|
name: Basic
|
||||||
|
needs: [code_scan, setup_dependencies]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- id: ard
|
||||||
|
yaml_file: ".test/esphome_ard_basic.yaml"
|
||||||
|
cache-hit: ${{ needs.setup_dependencies.outputs.cache-hit-arduino }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Firmware
|
||||||
|
if: steps.matrix.outputs.cache-hit != 'true'
|
||||||
|
uses: barndawgie/build-action@v1.9.0
|
||||||
|
with:
|
||||||
|
yaml_file: ${{ matrix.yaml_file }}
|
||||||
|
version: beta
|
||||||
|
|
||||||
|
build_bluetooth_proxy:
|
||||||
|
name: Bluetooth Proxy
|
||||||
|
needs: build_basic
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- id: idf_v4
|
||||||
|
base: idf_v4
|
||||||
|
yaml_file: ".test/esphome_idf_bluetooth_proxy.yaml"
|
||||||
|
- id: idf_v5
|
||||||
|
base: idf_v5
|
||||||
|
yaml_file: ".test/esphome_idf5_bluetooth_proxy.yaml"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Build Bluetooth Proxy Firmware
|
||||||
|
uses: barndawgie/build-action@v1.9.0
|
||||||
|
with:
|
||||||
|
yaml_file: ${{ matrix.yaml_file }}
|
||||||
|
version: beta
|
||||||
|
...
|
||||||
|
|
||||||
58
.github/workflows/validate_markdown.yml
vendored
Normal file
58
.github/workflows/validate_markdown.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
name: Validate Markdown
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.md'
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**/*.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
markdown-lint:
|
||||||
|
name: Markdown Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
|
||||||
|
# https://github.com/marketplace/actions/markdownlint-cli2-action
|
||||||
|
- name: Identify changed files
|
||||||
|
uses: tj-actions/changed-files@v41
|
||||||
|
id: changed-files
|
||||||
|
with:
|
||||||
|
files: '**/*.md'
|
||||||
|
separator: ","
|
||||||
|
# https://github.com/marketplace/actions/markdownlint-cli2-action
|
||||||
|
- name: Markdown Lint
|
||||||
|
uses: DavidAnson/markdownlint-cli2-action@v14
|
||||||
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
|
with:
|
||||||
|
globs: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||||
|
separator: ","
|
||||||
|
config: '.rules/.markdownlint.jsonc'
|
||||||
|
fix: true
|
||||||
|
|
||||||
|
markdown-links:
|
||||||
|
name: Check links
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
|
||||||
|
# https://github.com/gaurav-nelson/github-action-markdown-link-check
|
||||||
|
- name: Markdown links
|
||||||
|
uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||||
|
with:
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
check-modified-files-only: yes
|
||||||
|
config-file: '.rules/mlc_config.json'
|
||||||
|
base-branch: 'main'
|
||||||
|
...
|
||||||
30
.github/workflows/validate_python.yml
vendored
Normal file
30
.github/workflows/validate_python.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
name: Validate Python (flake8)
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '*.py'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '*.py'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
flake8-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Lint
|
||||||
|
steps:
|
||||||
|
- name: Check out source repository
|
||||||
|
uses: actions/checkout@main
|
||||||
|
- name: Set up Python environment
|
||||||
|
uses: actions/setup-python@main
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
- name: flake8 Lint
|
||||||
|
uses: py-actions/flake8@v2
|
||||||
|
with:
|
||||||
|
max-line-length: "200"
|
||||||
|
path: "components/tx_ultimate_easy"
|
||||||
|
...
|
||||||
47
.github/workflows/validate_yamllint.yml
vendored
Normal file
47
.github/workflows/validate_yamllint.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
name: Validate YAML (secondary files)
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.yaml'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.yml'
|
||||||
|
- '**/*.yaml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
code_scan:
|
||||||
|
name: Validate YAML
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
|
||||||
|
- name: Identify changed files
|
||||||
|
uses: tj-actions/changed-files@v41
|
||||||
|
id: changed-files
|
||||||
|
with:
|
||||||
|
files: '**/*.y*ml'
|
||||||
|
separator: ","
|
||||||
|
|
||||||
|
- name: Validate YAML
|
||||||
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
|
run: |
|
||||||
|
IFS=',' read -ra FILES <<< "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||||
|
for file in "${FILES[@]}"; do
|
||||||
|
if [[ "$file" =~ ^*\.yaml$ ]] || \
|
||||||
|
[[ "$file" =~ ^ESPHome/*\.yaml$ ]]; then
|
||||||
|
echo "Skipping $file"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "::group::Validating $file"
|
||||||
|
yamllint -c "./.rules/yamllint.yml" "$file"
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
...
|
||||||
4
.rules/.markdownlint.jsonc
Normal file
4
.rules/.markdownlint.jsonc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"MD013": { "line_length": 200 }
|
||||||
|
}
|
||||||
|
|
||||||
2
.rules/markdownlint.yml
Normal file
2
.rules/markdownlint.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
MD013:
|
||||||
|
line_length: 200
|
||||||
13
.rules/mlc_config.json
Normal file
13
.rules/mlc_config.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ignorePatterns": [
|
||||||
|
{
|
||||||
|
"pattern": "^http://homeassistant\\.local.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "^https://sonoff.tech/product/central-control-panel/nspanel/$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "^https://sonoff.tech/wp-content/uploads/2021/11/%E4%BA%A7%E5%93%81%E5%8F%82%E6%95%B0%E8%A1%A8-NSPanel-20210831.pdf$"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
42
.rules/yamllint.yml
Normal file
42
.rules/yamllint.yml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
|
||||||
|
---
|
||||||
|
yaml-files:
|
||||||
|
- '*.yaml'
|
||||||
|
- '*.yml'
|
||||||
|
- '.yamllint'
|
||||||
|
|
||||||
|
rules:
|
||||||
|
anchors:
|
||||||
|
forbid-undeclared-aliases: true
|
||||||
|
forbid-duplicated-anchors: true
|
||||||
|
braces: enable
|
||||||
|
brackets: enable
|
||||||
|
colons: enable
|
||||||
|
commas: enable
|
||||||
|
comments:
|
||||||
|
level: warning
|
||||||
|
comments-indentation:
|
||||||
|
level: warning
|
||||||
|
document-end:
|
||||||
|
level: warning
|
||||||
|
document-start:
|
||||||
|
level: warning
|
||||||
|
empty-lines: enable
|
||||||
|
empty-values: disable
|
||||||
|
float-values:
|
||||||
|
level: warning
|
||||||
|
hyphens: enable
|
||||||
|
indentation: enable
|
||||||
|
key-duplicates: enable
|
||||||
|
key-ordering: disable
|
||||||
|
line-length:
|
||||||
|
max: 200
|
||||||
|
new-line-at-end-of-file: enable
|
||||||
|
new-lines: enable
|
||||||
|
octal-values:
|
||||||
|
level: warning
|
||||||
|
quoted-strings: disable
|
||||||
|
trailing-spaces: enable
|
||||||
|
truthy:
|
||||||
|
level: warning
|
||||||
|
...
|
||||||
8
.test/esphome_ard_basic.yaml
Normal file
8
.test/esphome_ard_basic.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
packages:
|
||||||
|
basic_package: !include ../TX-Ultimate-Easy-ESPHome.yaml # Basic package
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
...
|
||||||
11
.test/esphome_idf5_bluetooth_proxy.yaml
Normal file
11
.test/esphome_idf5_bluetooth_proxy.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
packages:
|
||||||
|
basic_package: !include ../TX-Ultimate-Easy-ESPHome.yaml # Core package
|
||||||
|
addon_bluetooth_proxy: !include ../ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
version: 5.0.2
|
||||||
|
platform_version: 6.3.2
|
||||||
|
...
|
||||||
5
.test/esphome_idf_bluetooth_proxy.yaml
Normal file
5
.test/esphome_idf_bluetooth_proxy.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
packages:
|
||||||
|
basic_package: !include ../TX-Ultimate-Easy-ESPHome.yaml # Core package
|
||||||
|
addon_bluetooth_proxy: !include ../ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml
|
||||||
|
...
|
||||||
9
.test/secrets.yaml
Normal file
9
.test/secrets.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
api_encryption_key: MSANehPIH8kCp/vGcpPcKPSkYnv3zchyxkXCleXJinM=
|
||||||
|
mysntpserver: 192.168.0.1
|
||||||
|
web_server_password: NotASecret01
|
||||||
|
web_server_username: NotASecret01
|
||||||
|
wifi_password: NotASecret01
|
||||||
|
wifi_password_backup: NotASecret01
|
||||||
|
wifi_ssid_backup: NotASecret01
|
||||||
|
...
|
||||||
Reference in New Issue
Block a user