Skip to content

Commit

Permalink
Add hassfest action (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Apr 16, 2020
1 parent 7bc6cd1 commit 4b258cf
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# actions

GitHub Actions for Home Assistant workflows

## JQ
Expand All @@ -11,3 +12,30 @@ GitHub Actions for Home Assistant workflows
- `home-assistant/actions/py37-tox@master`
- `home-assistant/actions/py36-tox@master`
- `home-assistant/actions/py35-tox@master`

## hassfest

_Run hassfest to validate standalone integration repositories._

**action**: `home-assistant/actions/hassfest@master`

example implementation:

```yaml
name: Validate with hassfest

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master
```
This will run the `hassfest` action on every push and pull request to all branches, as well as every midnight.
33 changes: 33 additions & 0 deletions hassfest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3-alpine

COPY entrypoint.sh /entrypoint.sh

RUN \
apk add --no-cache \
python3-dev \
bash \
git \
gcc \
libc-dev \
libffi-dev \
openssl-dev \
\
&& rm -rf /var/cache/apk/* \
\
&& git clone --depth 1 https://github.com/home-assistant/core.git /core \
\
&& python3 -m pip install --no-cache-dir -e /core \
\
&& chmod +x /entrypoint.sh

WORKDIR "/github/workspace"
ENTRYPOINT ["/entrypoint.sh"]

LABEL "name"="hassfest"
LABEL "maintainer"="Home Assistant <[email protected]>"
LABEL "version"="1.0"

LABEL "com.github.actions.name"="hassfest"
LABEL "com.github.actions.description"="Run hassfest to validate standalone integration repositories"
LABEL "com.github.actions.icon"="terminal"
LABEL "com.github.actions.color"="gray-dark"
16 changes: 16 additions & 0 deletions hassfest/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

declare -a INTEGRATIONS

for manifestfile in $(find $GITHUB_WORKSPACE -type f -name manifest.json); do
INTEGRATIONS+=(--integration-path)
INTEGRATIONS+=("$(dirname -- ${manifestfile})")
done

if [ "${INTEGRATIONS}" = "" ]; then
echo "No integrations found!"
exit 1
fi
echo "${INTEGRATIONS[@]}"
python3 -m script.hassfest --action validate "${INTEGRATIONS[@]}"

0 comments on commit 4b258cf

Please sign in to comment.