add shared volume #895
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Home Assistant CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
config_changed: | |
runs-on: self-hosted | |
outputs: | |
homeassistant: ${{ steps.homeassistant.outputs.changed }} | |
infrastructure: ${{ steps.infrastructure.outputs.changed }} | |
steps: | |
- name: Clean Workspace Folder | |
run: | | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
- name: Getting Home Assistant configuration | |
uses: actions/checkout@v2 | |
- name: Get all changed files | |
id: changed | |
# yamllint disable rule:line-length | |
run: | | |
if [ $GITHUB_BASE_REF ]; then | |
# Pull Request | |
git fetch origin $GITHUB_BASE_REF --depth=1 | |
export DIFF=$( git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA ) | |
echo "Diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA" | |
else | |
# Push | |
git fetch origin ${{ github.event.before }} --depth=1 | |
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA ) | |
echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" | |
fi | |
echo "$DIFF" | |
echo ::set-output name=files::$DIFF | |
# yamllint enable rule:line-length | |
- name: Check Home Assistant config changed | |
id: homeassistant | |
run: "echo ::set-output name=changed::\ | |
$(grep -cE '.stubs/hass|\ | |
.github/workflows'\ | |
<<< \"${{ steps.changed.outputs.files }}\")" | |
- name: Check infrastructure files changed | |
id: infrastructure | |
run: "echo ::set-output name=changed::\ | |
$(grep -cE '.stubs/infrastructure|\ | |
docker-compose.*\\.yaml|\ | |
.github/workflows|\ | |
WebhookProxy|\ | |
Supervisor|\ | |
alarm/' | |
<<< \"${{ steps.changed.outputs.files }}\")" | |
- name: changed files output | |
run: | | |
echo "home assistant: ${{ steps.homeassistant.outputs.changed }}" | |
echo "infrastructure: ${{ steps.infrastructure.outputs.changed }}" | |
yamllint: | |
runs-on: self-hosted | |
needs: config_changed | |
if: needs.config_changed.outputs.homeassistant > 0 | |
steps: | |
- name: Clean Workspace Folder | |
run: | | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
- name: Getting Home Assistant configuration | |
uses: actions/checkout@v2 | |
- name: Running YAMLlint | |
uses: ibiqlik/action-yamllint@v3 | |
home_assistant_config_check: | |
runs-on: self-hosted | |
needs: config_changed | |
if: needs.config_changed.outputs.homeassistant > 0 | |
steps: | |
- name: Clean Workspace Folder | |
run: | | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
- name: Getting Home Assistant configuration | |
uses: actions/checkout@v2 | |
- name: Copy stub files | |
run: cp -R ./.stubs/hass/* ./hass | |
- name: Home Assistant Check Config | |
uses: docker://homeassistant/home-assistant:2024.7.3 | |
with: | |
args: >- | |
python -m homeassistant --config ./hass/ | |
--script check_config --info all | |
infrastructure: | |
runs-on: self-hosted | |
needs: config_changed | |
if: needs.config_changed.outputs.infrastructure > 0 | |
steps: | |
- name: Clean Workspace Folder | |
run: | | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
- name: Getting repository files | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Copy stub files | |
run: cp -R ./.stubs/infrastructure/* ./ | |
- name: Build the infrastructure | |
run: >- | |
docker compose | |
-f docker-compose.yaml | |
-f docker-compose-homeassistant.yaml | |
build --parallel |