Fix CI #55
Workflow file for this run
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: CI | |
env: | |
ROLE_NAME: bellackn.proxmox_lxc | |
defaults: | |
run: | |
working-directory: "bellackn.proxmox_lxc" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint w/ latest Ansible | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the codebase | |
uses: actions/checkout@v2 | |
with: | |
path: '${{ env.ROLE_NAME }}' | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-latest-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-latest | |
- name: Create ansible.cfg | |
run: > | |
printf '[defaults]\nroles_path=./tests/requirements/:../\ncollections_paths=./tests/requirements/:../' | |
> ansible.cfg | |
- name: Set up Python 3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install pip tools | |
run: | | |
pip3 install wheel --upgrade | |
- name: Install test dependencies | |
run: pip3 install --upgrade yamllint ansible ansible-lint | |
- name: Install role requirements | |
run: pip3 install -r requirements.txt | |
- name: Install Galaxy requirements | |
run: | | |
ansible-galaxy install -r tests/requirements.yml -p ./tests/requirements | |
ansible-galaxy collection install -r tests/requirements.yml -p ./tests/requirements | |
- name: Run linters | |
run: | | |
yamllint . | |
ansible-lint | |
- name: Test syntax | |
run: ansible-playbook tests/test.yml -i tests/inventory --syntax-check | |
galaxy: | |
name: "Ansible Galaxy import" | |
needs: | |
- lint | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger a new import on Ansible Galaxy | |
uses: robertdebock/galaxy-action@affc5472cd0b08f64a51eafba49b08898c1bbeb8 | |
with: | |
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} |