Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add github superlinter and auto release job #1

Merged
merged 18 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/1-issue_zh-cn.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
name: 错误报告
description: 集成或实体无法正常工作
labels: ["bug"]
body:
- type: input
attributes:
label: HA版本
placeholder: 2023.4.2
placeholder: 2024.5.3
- type: input
validations:
required: true
attributes:
label: 集成版本
placeholder: 0.3.18
placeholder: 0.3.23
- type: input
validations:
required: true
Expand Down
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/2-issue_en.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Bug report
description: Intergration or entity is not working right
labels: ["bug"]
Expand All @@ -18,7 +19,8 @@ body:
attributes:
label: Device type and model
placeholder: Air Conditioner 22012225
description: Can be found in Settings -> Devices & Services -> Midea AC LAN -> Devices -> Device Info
description: Can be found in Settings -> Devices & Services -> \
Midea AC LAN -> Devices -> Device Info
- type: input
validations:
required: true
Expand All @@ -34,4 +36,5 @@ body:
- type: textarea
attributes:
label: The logs
description: Should enable the debug log of Midea AC LAN, and post or upload the log when the error occurs to here
description: Should enable the debug log of Midea AC LAN, and post or \
upload the log when the error occurs to here
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: 新功能请求
description: 请求增加新设备支持或请求为已有设备增加新的功能
labels: ["enhancement"]
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/4-enhancement_en.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Enhancement
description: New feature or new device support request
labels: ["enhancement"]
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
---
blank_issues_enabled: true
3 changes: 3 additions & 0 deletions .github/linters/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 500
extend-ignore = E203,E701
4 changes: 4 additions & 0 deletions .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[FORMAT]
max-line-length=500
[MESSAGES CONTROL]
disable=import-error, logging-fstring-interpolation
6 changes: 6 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
extends: default
rules:
line-length:
max: 500
level: warning
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# PR Brief Description

## Reason & Detail

## Releted issue

fix #X

<!--
please change X to issue id, it will auto close this issue once PR closed
Example:
fix #1
it will auto close issue #1 once PR closed
-->
17 changes: 10 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
---
name: "CodeQL"

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]
# schedule:
# - cron: "42 8 * * 6"

permissions: { }

jobs:
analyze:
name: Analyze
Expand All @@ -20,22 +23,22 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ python ]
language: [python]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
39 changes: 39 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Linter

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions: { }

jobs:
build:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0

- name: Super-linter
uses: super-linter/[email protected] # x-release-please-version
env:
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
name: Release

on:
release:
types: [released]

permissions: { }

defaults:
run:
shell: bash

jobs:
generate_zip:
name: Generate release zip
runs-on: [ubuntu-latest]
timeout-minutes: 60
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
clean: true
- name: Zip release file
run: |
apt update && apt install zip || exit 1
echo 'show runner hostname'
hostname
echo 'show runner user'
whoami
echo 'show runner pwd'
pwd
echo 'show runner kernel'
uname -a
echo 'show runner pwd file list'
ls
ls -alht "custom_components/midea_ac_lan/" || exit 1
echo 'show manifest.json for debug'
cat "custom_components/midea_ac_lan/manifest.json" || exit 1
dst_dir="/github/workspace/artifacts"
sudo mkdir -p "$dst_dir" || exit 1
sudo chown -R $(id -u):$(id -g) "$dst_dir" || exit 1
sudo chmod -R 755 "$dst_dir" || exit 1
cd "custom_components/midea_ac_lan/" || exit 1
zip -r ../midea_ac_lan.zip ./* || exit 1
cp ../midea_ac_lan.zip "$dst_dir/midea_ac_lan.zip" || exit 1
ls -alht "$dst_dir" || exit 1
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: midea_ac_lan.zip
path: /github/workspace/artifacts

upload_release:
needs: generate_zip
name: Publish release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: midea_ac_lan.zip
merge-multiple: true

- name: Display Structure of Artifacts Files
run: ls -R

- name: Show Working Directory For Debug Purpose
run: |
echo 'show runner hostname'
hostname
echo 'show runner user'
whoami
echo 'show runner disk usage'
df -h
echo 'show runner pwd'
pwd
echo 'show runner kernel'
uname -a
echo 'show runner pwd file list'
ls
ls -alht
echo 'show runner artifacts'
ls -alht artifacts || exit 0
echo "github.ref: ${{github.ref}}"

- name: Upload images to Release Asset
uses: softprops/action-gh-release@v2
with:
files: artifacts/midea_ac_lan.zip
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
20 changes: 10 additions & 10 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@

---
name: HACS Validation

on:
pull_request:
push:
# schedule:
# - cron: "0 0 * * *"

permissions: { }

jobs:
validate:
name: HASS and Hassfest Validation
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v4"

- name: HACS Action
uses: hacs/action@main
with:
category: "integration"
- name: HACS Action
uses: hacs/action@main
with:
category: "integration"

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
# MIT License

Copyright (c) 2021 George Zhao

Expand Down
Loading
Loading