-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.66 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
name: Linter and test the project
env:
ANSIBLE_INVENTORY_UNPARSED_WARNING: 'False'
ANSIBLE_LOCALHOST_WARNING: 'False'
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
container:
image: quay.io/mmul/kpa
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: YAML check
run: yamllint tests/terraform_tfs_generator.yml
- name: Ansible Linter check
run: ansible-lint tests/terraform_tfs_generator.yml
- name: Ansible syntax check
run: ansible-playbook --syntax-check tests/terraform_tfs_generator.yml
test:
runs-on: ubuntu-latest
needs: lint
container:
image: quay.io/mmul/kpa
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Ansible effective execution (should produce terraform/*.tf files)
run: ansible-playbook -i tests/inventory tests/terraform_tfs_generator.yml
- name: Check terraform/*.tf files existence
run: for tf in cloud_init.tf mylabvmsgroup.vms.tf networks.tf pools.tf
provider.tf volumes.tf; do
echo "Checking tests/terraform/${tf}";
test -f tests/terraform/${tf};
done
trigger_galaxy_import:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Release Ansible Role to Galaxy
uses: hspaans/ansible-galaxy-action@v1
with:
api_key: ${{ secrets.GALAXY_API_KEY }}