Add native GitHub Action for Galaxy import #16
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: 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 }} |