forked from home-assistant/addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from azure pipelines to github action for CI (home-assistant#1646)
* Move from azure pipelines to github action for CI * pin version * pin directly
- Loading branch information
Showing
29 changed files
with
170 additions
and
653 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "06:00" | ||
open-pull-requests-limit: 10 |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.