|
1 | 1 | --- |
2 | | -# Copyright 2024 Cloudera, Inc. |
| 2 | +# Copyright 2025 Cloudera, Inc. |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 |
|
16 | | -name: Execute Precommit Linting and Checks |
| 16 | +name: Lint Collection |
17 | 17 |
|
18 | 18 | on: |
19 | 19 | pull_request: |
20 | 20 | push: |
21 | 21 | branches: [main, devel] |
22 | 22 | jobs: |
23 | 23 | pre-commit: |
| 24 | + name: Lint collection |
24 | 25 | runs-on: ubuntu-latest |
25 | 26 | steps: |
26 | | - - uses: actions/checkout@v4 |
27 | | - - uses: actions/setup-python@v5 |
28 | | - - uses: pre-commit/action@v3.0.1 |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Set up Python and caching |
| 31 | + uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: "3.12" |
| 34 | + cache: "pip" |
| 35 | + |
| 36 | + - name: Set up Ansible and Ansible collections and roles |
| 37 | + run: | |
| 38 | + sudo update-alternatives --install /usr/bin/python python $(which python3) 1 |
| 39 | + pip install --upgrade pip |
| 40 | + pip install "ansible-core<2.17" ansible-builder bindep pycodestyle voluptuous pylint pyyaml ansible-lint |
| 41 | +
|
| 42 | + - name: Install Ansible collections and roles |
| 43 | + run: | |
| 44 | + mkdir -p /usr/share/ansible/collections /usr/share/ansible/roles |
| 45 | + ansible-galaxy collection install -r builder/requirements.yml -p /usr/share/ansible/collections |
| 46 | + ansible-galaxy role install -r builder/requirements.yml -p /usr/share/ansible/roles |
| 47 | +
|
| 48 | + - name: Execute pre-commit |
| 49 | + uses: pre-commit/action@v3.0.1 |
| 50 | + env: |
| 51 | + ANSIBLE_COLLECTION_PATHS: /usr/share/ansible/collections |
| 52 | + ANSIBLE_ROLE_PATHS: /usr/share/ansible/roles |
0 commit comments