Files
default/.github/workflows/checks.yml
T
2020-11-21 19:42:05 +00:00

131 lines
3.6 KiB
YAML

name: "Checks"
on:
pull_request:
types: [opened, synchronize, reopened, unlabeled]
branches:
- master
jobs:
preflight:
runs-on: ubuntu-latest
name: Initialize
outputs:
repository: ${{ steps.repository.outputs.repository }}
category: ${{ steps.category.outputs.category }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Clone origin
run: git clone --depth 1 https://github.com/hacs/default /tmp/repositories/default
- name: Clone new addition
run: |
repo=$(python3 -m scripts.changed.repo)
git clone --depth 1 "https://github.com/$repo" /tmp/repositories/addition
- name: Set category
id: category
run: echo "::set-output name=category::$(python3 -m scripts.changed.category)"
- name: Set repository
id: repository
run: echo "::set-output name=repository::$(python3 -m scripts.changed.repo)"
- name: Upload shared artifacts
uses: actions/upload-artifact@master
with:
name: repositories
path: /tmp/repositories
owner:
runs-on: ubuntu-latest
name: Check Owner
needs: preflight
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Download shared artifacts
uses: actions/download-artifact@master
with:
name: repositories
path: /tmp/repositories
- name: Install dependencies if needed
run: make init
- name: Run the check
run: python3 -m scripts.check.owner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fork:
runs-on: ubuntu-latest
name: Check Fork
needs: preflight
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Download shared artifacts
uses: actions/download-artifact@master
with:
name: repositories
path: /tmp/repositories
- name: Install dependencies if needed
run: make init
- name: Run the check
run: python3 -m scripts.check.fork
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
hassfest:
runs-on: ubuntu-latest
name: "Check hassfest"
needs: preflight
if: needs.preflight.outputs.category == 'integration'
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Download shared artifacts
uses: actions/download-artifact@v1
with:
name: repositories
path: /tmp/repositories
- name: Pull Home Assistant Container
run: docker pull homeassistant/home-assistant:beta
- name: Run hassfest
run: |
integration=$(python3 -m scripts.helpers.integration_path)
domain=$(python3 -m scripts.helpers.domain)
docker run \
--entrypoint="" \
-w="/usr/src/homeassistant" \
-v "$integration":"/$domain" \
homeassistant/home-assistant:beta \
/bin/bash -c "\
python3 -m pip --disable-pip-version-check install \
pipdeptree==1.0.0 \
stdlib-list==0.7.0 \
tqdm==4.48.2 \
\
&& python3 -m \
script.hassfest \
--action validate \
--integration-path /$domain \
"
hacs:
runs-on: ubuntu-latest
name: "Run HACS Action"
needs: preflight
steps:
- name: HACS action
uses: "hacs/action@main"
with:
repository: ${{needs.preflight.outputs.repository}}
category: ${{needs.preflight.outputs.category}}