Files
default/.github/workflows/checks.yml
T
Joakim Sørensen 9e8788c060 Add preflight (#490)
* Add preflight

* fix syntax

* move check

* get event

* print

* return event

* use path

* tt

* move to helper

* add issue_comment

* remove should run

* check owner

* add more information to the logs

* test

* add finished

* move keys

* Update errors

* remove repo

* fix JQ run

* filter
2020-05-28 16:53:45 +02:00

127 lines
3.9 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
ready:
runs-on: ubuntu-latest
name: Ready
needs: preflight
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Is finished
run: python3 -m scripts.check.finished
matrix:
runs-on: ubuntu-latest
name: ${{ matrix.checks.name }}
needs: [ready, preflight]
strategy:
fail-fast: False
matrix:
checks:
- {check: "archived", name: "Check Archived", deps: True}
- {check: "brands", name: "Check Brands", deps: True}
- {check: "fork", name: "Check Fork", deps: True}
- {check: "hacs_manifest", name: "Check HACS Manifest"}
- {check: "images", name: "Check Images"}
- {check: "info", name: "Check Info"}
- {check: "manifest", name: "Check Manifest"}
- {check: "owner", name: "Check Owner", deps: True}
- {check: "repository", name: "Check Repository", deps: True}
- {check: "wheels", name: "Check Wheels", deps: True}
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
if: matrix.checks.deps
run: |
python3 -m pip install setuptools wheel
python3 -m pip install aiogithubapi
- name: Run the check
run: python3 -m scripts.check.${{ matrix.checks.check }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
hassfest:
runs-on: ubuntu-latest
name: "Check hassfest"
needs: [ready, 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="" -v "$integration":"/$domain" \
homeassistant/home-assistant:beta python3 -m \
script.hassfest --action validate --integration-path "/$domain"
hacs:
runs-on: ubuntu-latest
name: "Check HACS"
needs: [ready, preflight]
steps:
- name: HACS validation
uses: "hacs/integration/action@master"
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env:
REPOSITORY: ${{needs.preflight.outputs.repository}}
CATEGORY: ${{needs.preflight.outputs.category}}