common: Add FS-Cache. #258
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
--- | |
name: 'Code lint' | |
on: | |
push: | |
paths: | |
- "**.yml" | |
- "**.py" | |
- ".ansible-lint" | |
- ".flake8" | |
- ".yamllint.yml" | |
- ".github/workflows/lint.yml" | |
jobs: | |
static-analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: pip-lint | |
- name: Install dependencies | |
run: | | |
pip install -q --disable-pip-version-check wheel | |
pip install -q --disable-pip-version-check yamllint ansible-lint ansible flake8 flake8-polyfill bandit black radon | |
env: | |
PIP_CACHE_DIR: ~/.cache/pip | |
- name: Ansible code quality lint | |
run: ansible-lint | |
if: ${{ always() }} | |
- name: Python code quality lint | |
run: flake8 | |
if: ${{ always() }} | |
- name: Python security lint | |
run: bandit -r . | |
if: ${{ always() }} | |
- name: Python code style lint | |
run: black --check --diff . | |
if: ${{ always() }} | |
- name: Python code complexity | |
run: radon cc -n D . | |
if: ${{ always() }} | |
- name: Python code maintainability | |
run: radon mi -n B . | |
if: ${{ always() }} | |
publish: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'JGoutin/ansible_home' && github.ref_type == 'tag' }} | |
needs: [static-analysis] | |
environment: Ansible Galaxy | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: pip install -q --disable-pip-version-check ansible | |
- name: Build | |
run: | | |
sed -i 's/0.0.0/${{ github.ref_name }}/g' galaxy.yml | |
ansible-galaxy collection build -vvv | |
- name: Publish | |
run: "ansible-galaxy collection publish jgoutin-home-*.tar.gz --token ${{ secrets.ANSIBLE_GALAXY_TOKEN }}" | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false |