From 1b96d96938050061cc3433c4c14918534ef7d847 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 8 Dec 2019 12:07:57 +0000 Subject: [PATCH] Add GitHub workflows for linting --- .github/workflows/ansible.yml | 17 +++++++++++++++++ .github/workflows/lint.yml | 17 +++++++++++++++++ scripts/ansible-lint.sh | 13 +++++++++++++ scripts/lint.sh | 6 +----- yamllint.yml | 1 + 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ansible.yml create mode 100644 .github/workflows/lint.yml create mode 100755 scripts/ansible-lint.sh diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml new file mode 100644 index 0000000..29a0f46 --- /dev/null +++ b/.github/workflows/ansible.yml @@ -0,0 +1,17 @@ +name: Ansible + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: pip install -r dev-requirements.txt + - name: Run linters + run: ./scripts/ansible-lint.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8c9879d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +name: Lint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: pip install -r dev-requirements.txt + - name: Run linters + run: ./scripts/lint.sh diff --git a/scripts/ansible-lint.sh b/scripts/ansible-lint.sh new file mode 100755 index 0000000..7b33cc5 --- /dev/null +++ b/scripts/ansible-lint.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +PATH=env/bin:${PATH} + +set -x + +yamllint -sc yamllint.yml ansible/ + +ansible-lint ansible/main.yml -p -c ansible/.ansible-lint + +ansible-playbook -i ansible/hosts ansible/main.yml --syntax-check diff --git a/scripts/lint.sh b/scripts/lint.sh index 7808c43..1e2b808 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -6,8 +6,4 @@ PATH=env/bin:${PATH} set -x -yamllint -sc yamllint.yml yamllint.yml ansible/ - -ansible-lint ansible/main.yml -p -c ansible/.ansible-lint - -ansible-playbook -i ansible/hosts ansible/main.yml --syntax-check +yamllint -sc yamllint.yml yamllint.yml .github/ diff --git a/yamllint.yml b/yamllint.yml index aa6adf7..2e6cda4 100644 --- a/yamllint.yml +++ b/yamllint.yml @@ -2,5 +2,6 @@ extends: default rules: document-start: "disable" + truthy: "disable" line-length: max: 150