Skip to content

Commit

Permalink
ci: separate workflow files (#13)
Browse files Browse the repository at this point in the history
* ci: separate workflow files

*fix: delete Pipenv stuff

* doc: add 'name'
  • Loading branch information
bellackn authored Jan 30, 2024
1 parent 4f8708c commit 8acf4b5
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 1,157 deletions.
42 changes: 5 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,11 @@ name: CI

jobs:

lint:
name: Run linters
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

# we need '../' so the actual role can be tested, and '/tmp' is where dependencies will be installed
- name: Create ansible.cfg
run: >
printf '[defaults]\nroles_path=../:/tmp'
> roles/proxmox_lxc/ansible.cfg
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install test dependencies
run: pip install --upgrade ansible ansible-lint yamllint

- name: Install Galaxy requirements
run: |
cd roles/proxmox_lxc
ansible-galaxy role install -r tests/requirements.yml -p /tmp
ansible-galaxy collection install -r tests/requirements.yml -p /tmp
- name: Run yamllint
run: yamllint .

- name: Run ansible-lint
run: ansible-lint

- name: Test syntax
run: |
cd roles/proxmox_lxc
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
test-role-proxmox-lxc:
name: Test proxmox_lxc role
uses: ./.github/workflows/test_role.yml
with:
ROLE_NAME: proxmox_lxc

ansible-test:
name: Run ansible-test
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test_role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Test an Ansible role

"on":
workflow_call:
inputs:
ROLE_NAME:
type: string
required: true

jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

# we need '../' so the actual role can be tested, and '/tmp' is where dependencies will be installed
- name: Create ansible.cfg
run: >
printf '[defaults]\nroles_path=../:/tmp'
> roles/${{ inputs.ROLE_NAME }}/ansible.cfg
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install test dependencies
run: pip install --upgrade ansible ansible-lint yamllint

- name: Install Galaxy requirements
run: |
cd roles/${{ inputs.ROLE_NAME }}
ansible-galaxy role install -r tests/requirements.yml -p /tmp
ansible-galaxy collection install -r tests/requirements.yml -p /tmp
- name: Run yamllint
run: yamllint .

- name: Run ansible-lint
run: ansible-lint

- name: Test syntax
run: |
cd roles/${{ inputs.ROLE_NAME }}
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

4 changes: 1 addition & 3 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
antsibull := 'pipenv run antsibull-changelog'

_default:
@just --list

# updates version in galaxy.yml and creates changelog
release VERSION:
@sed -i -e 's/^version: .*$/version: {{VERSION}}/' galaxy.yml
@{{antsibull}} release
@antsibull-changelog release
alias r := release
18 changes: 0 additions & 18 deletions Pipfile

This file was deleted.

1,097 changes: 0 additions & 1,097 deletions Pipfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: bellackn
name: homelab
version: 5.0.0
version: 5.0.1
readme: README.md
authors:
- Nico Bellack <[email protected]>
Expand Down

0 comments on commit 8acf4b5

Please sign in to comment.