Skip to content

Commit 4b258cf

Browse files
authored
Add hassfest action (#5)
1 parent 7bc6cd1 commit 4b258cf

3 files changed

Lines changed: 77 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# actions
2+
23
GitHub Actions for Home Assistant workflows
34

45
## JQ
@@ -11,3 +12,30 @@ GitHub Actions for Home Assistant workflows
1112
- `home-assistant/actions/py37-tox@master`
1213
- `home-assistant/actions/py36-tox@master`
1314
- `home-assistant/actions/py35-tox@master`
15+
16+
## hassfest
17+
18+
_Run hassfest to validate standalone integration repositories._
19+
20+
**action**: `home-assistant/actions/hassfest@master`
21+
22+
example implementation:
23+
24+
```yaml
25+
name: Validate with hassfest
26+
27+
on:
28+
push:
29+
pull_request:
30+
schedule:
31+
- cron: '0 0 * * *'
32+
33+
jobs:
34+
validate:
35+
runs-on: "ubuntu-latest"
36+
steps:
37+
- uses: "actions/checkout@v2"
38+
- uses: home-assistant/actions/hassfest@master
39+
```
40+
41+
This will run the `hassfest` action on every push and pull request to all branches, as well as every midnight.

hassfest/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM python:3-alpine
2+
3+
COPY entrypoint.sh /entrypoint.sh
4+
5+
RUN \
6+
apk add --no-cache \
7+
python3-dev \
8+
bash \
9+
git \
10+
gcc \
11+
libc-dev \
12+
libffi-dev \
13+
openssl-dev \
14+
\
15+
&& rm -rf /var/cache/apk/* \
16+
\
17+
&& git clone --depth 1 https://github.com/home-assistant/core.git /core \
18+
\
19+
&& python3 -m pip install --no-cache-dir -e /core \
20+
\
21+
&& chmod +x /entrypoint.sh
22+
23+
WORKDIR "/github/workspace"
24+
ENTRYPOINT ["/entrypoint.sh"]
25+
26+
LABEL "name"="hassfest"
27+
LABEL "maintainer"="Home Assistant <hello@home-assistant.io>"
28+
LABEL "version"="1.0"
29+
30+
LABEL "com.github.actions.name"="hassfest"
31+
LABEL "com.github.actions.description"="Run hassfest to validate standalone integration repositories"
32+
LABEL "com.github.actions.icon"="terminal"
33+
LABEL "com.github.actions.color"="gray-dark"

hassfest/entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
declare -a INTEGRATIONS
5+
6+
for manifestfile in $(find $GITHUB_WORKSPACE -type f -name manifest.json); do
7+
INTEGRATIONS+=(--integration-path)
8+
INTEGRATIONS+=("$(dirname -- ${manifestfile})")
9+
done
10+
11+
if [ "${INTEGRATIONS}" = "" ]; then
12+
echo "No integrations found!"
13+
exit 1
14+
fi
15+
echo "${INTEGRATIONS[@]}"
16+
python3 -m script.hassfest --action validate "${INTEGRATIONS[@]}"

0 commit comments

Comments
 (0)