From af7e4e75049029e31c193ff63c2714f9533e833e Mon Sep 17 00:00:00 2001 From: Alexander Gorelyshev Date: Thu, 4 Dec 2025 13:50:54 +0400 Subject: [PATCH] Add a linting workflow --- .ansible-lint | 9 ++++++++ .github/workflows/linters.yml | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .ansible-lint create mode 100644 .github/workflows/linters.yml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..43cae14 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,9 @@ +--- +profile: production +strict: true + +# Enable checking of loop variable prefixes in roles +loop_var_prefix: "^(__|{role}_)" + +exclude_paths: + - .github/ diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..7c3eaad --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,41 @@ +--- +name: linters + +on: + pull_request: + branches: [ "master" ] + push: + branches: [ "master" ] + +jobs: + + ansible-lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v5 + + + - uses: mamba-org/setup-micromamba@7f29b8b80078b1b601dfa018b0f7425c587c63bb + with: + micromamba-version: '2.4.0-0' + environment-file: ci/conda.yml + init-shell: bash + post-cleanup: 'all' + + # - name: "Install role dependencies" + # run: ansible-galaxy install -r requirements.yml + # shell: micromamba-shell {0} + + - name: Check workflow files themselves with ActionLint + run: actionlint + shell: micromamba-shell {0} + + - name: Check environment files with YAMLLint + run: yamllint ci/*.yml + shell: micromamba-shell {0} + + - name: Run ansible-lint + run: ansible-lint -c .ansible-lint + shell: micromamba-shell {0}