diff --git a/.devcontainer/start_supervisor.sh b/.devcontainer/start_supervisor.sh index 4deca983792..29dac10f619 100755 --- a/.devcontainer/start_supervisor.sh +++ b/.devcontainer/start_supervisor.sh @@ -66,7 +66,7 @@ function cleanup_hass_data() { function cleanup_docker() { echo "Cleaning up stopped containers..." - docker rm $(docker ps -a -q) + docker rm "$(docker ps -a -q)" } function cleanup_lastboot() { diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..10f096219ea --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + time: "06:00" + open-pull-requests-limit: 10 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4e3dc4855b1..00000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build -on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - master - -jobs: - init: - runs-on: ubuntu-latest - name: Initialize builds - outputs: - changed_files: ${{ steps.changed_files.outputs.all }} - steps: - - name: Check out the repository - uses: actions/checkout@v2 - - - name: Get changed files - id: changed_files - uses: jitterbit/get-changed-files@v1 - - build: - needs: init - runs-on: ubuntu-latest - name: Build ${{ matrix.addon }} add-on - outputs: - changed: ${{ steps.changed.outputs.changed }} - strategy: - fail-fast: False - matrix: - addon: - - ada - - almond - - cec_scan - - check_config - - configurator - - deconz - - dhcp_server - - dnsmasq - - duckdns - - git_pull - - google_assistant - - homematic - - letsencrypt - - mariadb - - mosquitto - - nginx_proxy - - rpc_shutdown - - samba - - ssh - - tellstick - - zwave - steps: - - name: Check if ${{ matrix.addon }} was changed - id: changed - run: | - if [[ "${{ needs.init.outputs.changed_files }}" =~ "${{ matrix.addon }}" ]]; then - echo "::set-output name=changed::true" - fi - - - name: Check out repository - if: steps.changed.outputs.changed == 'true' - uses: actions/checkout@v2 - - - name: Test docker build for ${{ matrix.addon }} - if: steps.changed.outputs.changed == 'true' - uses: home-assistant/builder@master - with: - args: | - --test \ - --all \ - --target /data/${{ matrix.addon }} \ No newline at end of file diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml new file mode 100644 index 00000000000..572e324210e --- /dev/null +++ b/.github/workflows/builder.yml @@ -0,0 +1,109 @@ +name: Build add-on + +env: + BUILD_ARGS: "--test" + MONITORED_FILES: "apparmor.txt build.json config.json Dockerfile data rootfs" + +on: + pull_request: + branches: ["master"] + push: + branches: ["master"] + +jobs: + init: + runs-on: ubuntu-latest + name: Initialize builds + outputs: + changed_files: ${{ steps.changed_files.outputs.all }} + changed_addons: ${{ steps.changed_addons.outputs.addons }} + changed: ${{ steps.changed_addons.outputs.changed }} + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Get changed files + id: changed_files + uses: jitterbit/get-changed-files@v1 + + - name: Get add-ons + id: addons + run: | + addons=$(find ./ -name config.json | cut -d "/" -f2 | sort -u) + echo "::set-output name=addons::$addons" + + - name: Get changed add-ons + id: changed_addons + run: | + declare -a changed_addons + for addon in ${{ steps.addons.outputs.addons }}; do + if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then + for file in ${{ env.MONITORED_FILES }}; do + if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then + changed_addons+=("\"${addon}\","); + fi + done + fi + done + + changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev) + echo "::set-output name=addons::[$changed]" + if [[ ! -z ${changed} ]]; then + echo "Changed add-ons: $changed" + echo "::set-output name=changed::true" + else + echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})" + fi + + build: + needs: init + runs-on: ubuntu-latest + if: needs.init.outputs.changed == 'true' + name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on + strategy: + matrix: + addon: ${{ fromJson(needs.init.outputs.changed_addons) }} + arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Get information + id: info + uses: home-assistant/actions/helpers/info@master + with: + path: "./${{ matrix.addon }}" + + - name: Check add-on + id: check + run: + if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then + echo "::set-output name=buld_arch::true"; + else + echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build" + fi + + - name: Set build arguments + if: steps.check.outputs.buld_arch == 'true' + run: | + if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then + echo "BUILD_ARGS=--docker-hub-check" >> $GITHUB_ENV; + fi + + - name: Login to DockerHub + if: env.BUILD_ARGS == '--docker-hub-check' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build ${{ matrix.addon }} add-on + if: steps.check.outputs.buld_arch == 'true' + uses: home-assistant/builder@master + with: + args: | + ${{ env.BUILD_ARGS }} \ + --${{ matrix.arch }} \ + --target /data/${{ matrix.addon }} \ + --docker-hub homeassistant \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..fb68e5b9a41 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,52 @@ +name: Lint + +env: + HADOLINT_VERSION: v1.17.2 + SHELLCHECK_OPTS: -e SC1008 -s bash + +on: + pull_request: + branches: ["master"] + push: + branches: ["master"] + +jobs: + hadolint: + runs-on: ubuntu-latest + name: hadolint + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Run linter + id: changed_files + run: | + shopt -s globstar + for dockerfile in **/Dockerfile; do + echo "Linting: $dockerfile" + docker run --rm -i \ + -v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \ + hadolint/hadolint:${{ env.HADOLINT_VERSION }} < "$dockerfile" + done + + jq: + runs-on: ubuntu-latest + name: JQ + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Run linter + run: | + shopt -s globstar + cat **/*.json | jq '.' + + shellcheck: + runs-on: ubuntu-latest + name: ShellCheck + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Run linter + uses: ludeeus/action-shellcheck@0.5.0 \ No newline at end of file diff --git a/.shellcheckrc b/.shellcheckrc deleted file mode 100644 index eb84868412e..00000000000 --- a/.shellcheckrc +++ /dev/null @@ -1 +0,0 @@ -disable=SC1008 \ No newline at end of file diff --git a/README.md b/README.md index c5973a156c5..4262ecc05db 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Home Assistant Add-ons: The official repository -[![Build Status](https://dev.azure.com/home-assistant/Hass.io/_apis/build/status/addons?branchName=master)](https://dev.azure.com/home-assistant/Hass.io/_build/latest?definitionId=7&branchName=master) - Add-ons for Home Assistant, allow you to extend the functionality around your Home Assistant setup. These add-ons can consist of an application that Home Assistant can integrate with (e.g., a MQTT broker or database server) diff --git a/ada/azure-pipelines.yml b/ada/azure-pipelines.yml deleted file mode 100644 index 843c81aa2f8..00000000000 --- a/ada/azure-pipelines.yml +++ /dev/null @@ -1,28 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - ada/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "ada" - arch: - - amd64 - - armv7 - - armhf diff --git a/almond/azure-pipelines.yml b/almond/azure-pipelines.yml deleted file mode 100644 index f53a71ce651..00000000000 --- a/almond/azure-pipelines.yml +++ /dev/null @@ -1,28 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - almond/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "almond" - arch: - - amd64 - - armv7 - - aarch64 diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index a02d45d1d13..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,54 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master -pr: - - master - -variables: - versionHadolint: "v1.17.2" - versionShellCheck: "v0.7.0" - -jobs: - - job: "Hadolint" - pool: - vmImage: "ubuntu-latest" - steps: - - script: sudo docker pull hadolint/hadolint:$(versionHadolint) - displayName: "Install Hadolint" - - script: | - set -e - shopt -s globstar - for dockerfile in **/Dockerfile - do - echo "Linting: $dockerfile" - sudo docker run --rm -i \ - -v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \ - hadolint/hadolint:$(versionHadolint) < "$dockerfile" - done - displayName: "Run Hadolint" - - - job: "ShellCheck" - pool: - vmImage: "ubuntu-latest" - steps: - - script: sudo docker pull koalaman/shellcheck:$(versionShellCheck) - displayName: "Install ShellCheck" - - script: | - shopt -s globstar - sudo docker run --rm -i \ - -v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) -s bash **/{*.sh,run} - displayName: "Run ShellCheck" - - - job: "JQ" - pool: - vmImage: "ubuntu-latest" - steps: - - script: sudo apt-get install -y jq - displayName: "Install JQ" - - bash: | - shopt -s globstar - cat **/*.json | jq '.' - displayName: "Run JQ" diff --git a/cec_scan/azure-pipelines.yml b/cec_scan/azure-pipelines.yml deleted file mode 100644 index b59147f480d..00000000000 --- a/cec_scan/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - cec_scan/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "cec_scan" diff --git a/check_config/azure-pipelines.yml b/check_config/azure-pipelines.yml deleted file mode 100644 index c40bbc8db51..00000000000 --- a/check_config/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - check_config/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "check_config" diff --git a/configurator/azure-pipelines.yml b/configurator/azure-pipelines.yml deleted file mode 100644 index addaf821ac5..00000000000 --- a/configurator/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - configurator/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "configurator" diff --git a/deconz/azure-pipelines.yml b/deconz/azure-pipelines.yml deleted file mode 100644 index a603c3ac2df..00000000000 --- a/deconz/azure-pipelines.yml +++ /dev/null @@ -1,28 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - deconz/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "deconz" - arch: - - armhf - - amd64 - - aarch64 diff --git a/dhcp_server/azure-pipelines.yml b/dhcp_server/azure-pipelines.yml deleted file mode 100644 index 4277d697b0b..00000000000 --- a/dhcp_server/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - dhcp_server/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "dhcp_server" diff --git a/dnsmasq/azure-pipelines.yml b/dnsmasq/azure-pipelines.yml deleted file mode 100644 index 36a8ff7ac80..00000000000 --- a/dnsmasq/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - dnsmasq/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "dnsmasq" diff --git a/duckdns/azure-pipelines.yml b/duckdns/azure-pipelines.yml deleted file mode 100644 index d8490465cdd..00000000000 --- a/duckdns/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - duckdns/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "duckdns" diff --git a/git_pull/azure-pipelines.yml b/git_pull/azure-pipelines.yml deleted file mode 100644 index 9538deb6570..00000000000 --- a/git_pull/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - git_pull/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "git_pull" diff --git a/google_assistant/azure-pipelines.yml b/google_assistant/azure-pipelines.yml deleted file mode 100644 index f66490b5480..00000000000 --- a/google_assistant/azure-pipelines.yml +++ /dev/null @@ -1,28 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - google_assistant/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "google_assistant" - arch: - - armv7 - - armhf - - amd64 diff --git a/homematic/azure-pipelines.yml b/homematic/azure-pipelines.yml deleted file mode 100644 index dc5273f591c..00000000000 --- a/homematic/azure-pipelines.yml +++ /dev/null @@ -1,27 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - homematic/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "homematic" - arch: - - armv7 - - i386 diff --git a/letsencrypt/azure-pipelines.yml b/letsencrypt/azure-pipelines.yml deleted file mode 100644 index bc02f056b9b..00000000000 --- a/letsencrypt/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - letsencrypt/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "letsencrypt" diff --git a/mariadb/azure-pipelines.yml b/mariadb/azure-pipelines.yml deleted file mode 100644 index 25ec7e0e046..00000000000 --- a/mariadb/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - mariadb/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "mariadb" diff --git a/mosquitto/azure-pipelines.yml b/mosquitto/azure-pipelines.yml deleted file mode 100644 index faff39f79e6..00000000000 --- a/mosquitto/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - mosquitto/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "mosquitto" diff --git a/nginx_proxy/azure-pipelines.yml b/nginx_proxy/azure-pipelines.yml deleted file mode 100644 index 8dc1ddde16a..00000000000 --- a/nginx_proxy/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - nginx_proxy/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "nginx_proxy" diff --git a/rpc_shutdown/azure-pipelines.yml b/rpc_shutdown/azure-pipelines.yml deleted file mode 100644 index 5534c1f236d..00000000000 --- a/rpc_shutdown/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - rpc_shutdown/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "rpc_shutdown" diff --git a/samba/azure-pipelines.yml b/samba/azure-pipelines.yml deleted file mode 100644 index c00234af21c..00000000000 --- a/samba/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - samba/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "samba" diff --git a/ssh/azure-pipelines.yml b/ssh/azure-pipelines.yml deleted file mode 100644 index 4323a06ac86..00000000000 --- a/ssh/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - ssh/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "ssh" diff --git a/tellstick/azure-pipelines.yml b/tellstick/azure-pipelines.yml deleted file mode 100644 index 26f2b93c3dd..00000000000 --- a/tellstick/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - tellstick/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "tellstick" diff --git a/zwave/azure-pipelines.yml b/zwave/azure-pipelines.yml deleted file mode 100644 index 0dccb7beb45..00000000000 --- a/zwave/azure-pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - branches: - include: - - master - paths: - include: - - zwave/* -pr: none -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -variables: - - group: docker - -jobs: - - template: templates/azp-job-addon.yaml@azure - parameters: - addon: "zwave"