-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.49 KB
/
tests.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
---
name: "Tests"
on: # yamllint disable-line rule:truthy
push:
branches: "**"
env:
TERRAFORM_WORKING_DIRECTORY: "./tests/setup"
ANSIBLE_WORKING_DIRECTORY: "./tests/testsuite"
ANSIBLE_LOG_PATH: "testsuite.log"
jobs:
tests:
runs-on: "self-hosted"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-node@v3"
with:
node-version: "20"
- uses: "hashicorp/setup-terraform@v3"
with:
terraform_version: "1.0.10"
- uses: "actions/setup-python@v3"
with:
python-version: "3.10.12"
- name: "Install Python dependencies"
run: "pip install --no-cache-dir --user ansible==9.5.1"
- name: "Initialize Terraform infrastructure"
run: "terraform init"
working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}"
- name: "Apply Terraform infrastructure"
run: "terraform apply --auto-approve"
working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}"
- name: "Run Ansible testsuite"
run: "ansible-playbook --inventory inventory.yml deploy.yml"
working-directory: ${{ env.ANSIBLE_WORKING_DIRECTORY }}
- uses: "actions/upload-artifact@v4"
if: "${{ always() }}"
with:
path: "${{ env.ANSIBLE_WORKING_DIRECTORY }}/testsuite.log"
- name: "Destroy Terraform environment"
run: "terraform destroy --auto-approve"
if: "${{ always() }}"
working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}"