Skip to content

Commit

Permalink
Fix requirements (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Feb 9, 2021
1 parent ba12c16 commit af2cb4f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
14 changes: 8 additions & 6 deletions checks/requirements
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ function checkCondition () {
function checkRun () {
repoPath=$(cat "$GITHUB_ACTION_PATH"/data/path)
mkdir -p "$repoPath/requirements"
wget -q -O "$GITHUB_ACTION_PATH/helpers/requirements/validate_requirements.py" \
https://raw.githubusercontent.com/home-assistant/wheels-custom-integrations/master/scripts/validate_requirements.py
cd "$GITHUB_ACTION_PATH/helpers/requirements"
jq -r .requirements "$GITHUB_ACTION_PATH/data/manifest.json" > ./requirements.json
git clone --depth 1 https://github.com/home-assistant/wheels-custom-integrations.git "$repoPath/wheels-custom-integrations"
cd "$repoPath/wheels-custom-integrations"
jq -r .requirements "$GITHUB_ACTION_PATH/data/manifest.json" > "$repoPath/wheels-custom-integrations/validate_requirements/requirements.json"
jq . ./requirements.json
docker build . -t homeassistant/home-assistant:beta
cp "$GITHUB_ACTION_PATH/helpers/requirements/__init__.py" "$repoPath/wheels-custom-integrations/validate_requirements"
cp "$GITHUB_ACTION_PATH/helpers/requirements/run.sh" "$repoPath/wheels-custom-integrations/validate_requirements"
touch "$repoPath/wheels-custom-integrations/validate_requirements/files.json"
docker build -t validate -f validate_requirements/Dockerfile .
set +e
docker run homeassistant/home-assistant:beta
docker run --rm validate
requirements="$?"
set -e
if [ "${requirements}" == 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion helpers/requirements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def validate() -> bool:
print()
piped_input = sys.stdin.read()
requirements = []
with open("/entry/requirements/requirements.json", "r") as requirements_file:
with open("/action/validate/requirements.json", "r") as requirements_file:
requirements = json.loads(requirements_file.read())
validated_ok = True
print("Requirements to validate:", len(requirements))
Expand Down
6 changes: 6 additions & 0 deletions helpers/requirements/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

mkdir -p /action
mv /validate /action/validate
cd /action || exit 1
python3 -m validate

0 comments on commit af2cb4f

Please sign in to comment.