-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (81 loc) · 2.82 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
pull_request: ~
env:
DEFAULT_PYTHON: "3.11"
jobs:
validate-hacs:
runs-on: "ubuntu-latest"
name: Validate with HACS
steps:
- uses: "actions/checkout@v4"
- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands
validate-hassfest:
runs-on: "ubuntu-latest"
name: Validate with Hassfest
steps:
- uses: "actions/checkout@v4"
- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
code-quality:
runs-on: "ubuntu-latest"
name: Check code quality
steps:
- uses: "actions/checkout@v4"
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "pip"
- name: Install dependencies
run: |
pip install -r requirements.txt
# Following steps cannot run by pre-commit.ci as repo = local
- name: Run mypy
run: mypy custom_components/
- name: Pylint review
run: pylint custom_components/
create_zip_file:
name: Create zip file for testing
permissions:
# Required to upload/save artifact, otherwise you'll get
# "Error: Resource not accessible by integration"
contents: write
# Required to post comment, otherwise you'll get
# "Error: Resource not accessible by integration"
pull-requests: write
needs:
- code-quality
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4
- name: 📦 Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/bticino_x8000"
zip bticino_x8000.zip -r ./
mv bticino_x8000.zip "${{ github.workspace }}/"
- name: 📤 Create comment with the artifiactory
uses: gavv/pull-request-artifacts@v2
with:
# Commit hash that triggered PR
commit: ${{ github.sha }}
# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-branch: artifacts
inter-link: false
comment-title: |
🤖 Pull request artifacts
For testing please download the zip file below and extract it in `[config folder]/custom_components/bticino_x8000`.
# Whitespace-separated list of files to upload
artifacts: |
bticino_x8000.zip