-
-
Notifications
You must be signed in to change notification settings - Fork 24
161 lines (142 loc) · 4.77 KB
/
Copy pathci.yaml
File metadata and controls
161 lines (142 loc) · 4.77 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: CI
on: # yamllint disable-line rule:truthy
push:
branches:
- main
pull_request:
schedule:
- cron: 0 12 * * *
permissions:
contents: read
env:
FORCE_COLOR: 1
DEFAULT_PYTHON: "3.11"
PYUPGRADE_TARGET: "--py311-plus"
concurrency:
# yamllint disable-line rule:line-length
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
yamllint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run yamllint
uses: frenck/action-yamllint@34b4bbcaeabedcfefad6adea8c5bbc42af0e2d47 # v1.5.0
with:
config: .yamllint
bundle:
name: Bundle external component and ESPHome
runs-on: ubuntu-24.04
outputs:
repo-hash: ${{ github.sha }}
steps:
- name: Check out this project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check out code from ESPHome project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: esphome/esphome
ref: dev
path: esphome
- name: Copy external component into the esphome project
run: |
cd esphome
ln -sf ../venv venv
- name: Archive prepared repository
uses: pyTooling/upload-artifact@a59f191f676112c140f4330026bbb6ac19b7a44d # v7
with:
name: bundle
path: .
include-hidden-files: true
retention-days: 1
common:
name: Create common environment
runs-on: ubuntu-24.04
needs: bundle
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Generate cache-key
id: cache-key
run: echo key="${{ hashFiles('esphome/requirements.txt', 'esphome/requirements_test.txt') }}" >> $GITHUB_OUTPUT
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ steps.cache-key.outputs.key }}
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python --version
cd esphome
pip install -r requirements.txt -r requirements_test.txt
pip install -e .
esphome-config:
name: Validate example configurations
runs-on: ubuntu-24.04
needs:
- bundle
- common
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Validate example configurations
run: |
. venv/bin/activate
for YAML in *example.yaml; do
if [ "${{ github.event_name }}" = "pull_request" ]; then
sed -i "s#ref: main#ref: ${{ github.event.pull_request.head.ref }}#" $YAML
fi
esphome config $YAML
done
esphome-compile:
name: Build example configurations
runs-on: ubuntu-24.04
needs:
- bundle
- common
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Compile example configurations
run: |
. venv/bin/activate
for YAML in *example.yaml; do
if [ "${{ github.event_name }}" = "pull_request" ]; then
sed -i "s#ref: main#ref: ${{ github.event.pull_request.head.ref }}#" $YAML
fi
esphome compile $YAML
done