-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,49 @@ | ||
name: Tests | ||
name: "Tests" | ||
|
||
on: | ||
push: | ||
branches: '**' | ||
branches: "**" | ||
|
||
env: | ||
TERRAFORM_WORKING_DIR: ./tests/setup | ||
ANSIBLE_WORKING_DIR: ./tests/testsuite | ||
TERRAFORM_WORKING_DIRECTORY: "./tests/setup" | ||
ANSIBLE_WORKING_DIRECTORY: "./tests/testsuite" | ||
|
||
jobs: | ||
setup: | ||
runs-on: self-hosted | ||
runs-on: "self-hosted" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- uses: hashicorp/setup-terraform@v3 | ||
- uses: "actions/checkout@v4" | ||
- uses: "actions/setup-node@v3" | ||
- 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_DIR }} | ||
- 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_DIR }} | ||
- name: "Apply Terraform infrastructure" | ||
run: "terraform apply --auto-approve" | ||
working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}" | ||
|
||
testsuite: | ||
runs-on: self-hosted | ||
needs: setup | ||
runs-on: "self-hosted" | ||
needs: "setup" | ||
steps: | ||
- 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: Run Ansible testsuite | ||
run: ansible-playbook --inventory inventory.yml deploy.yml | ||
working-directory: ${{ env.ANSIBLE_WORKING_DIR }} | ||
- name: "Run Ansible testsuite" | ||
run: "ansible-playbook --inventory inventory.yml deploy.yml" | ||
working-directory: "${{ env.ANSIBLE_WORKING_DIRECTORY }}" | ||
|
||
cleanup: | ||
runs-on: self-hosted | ||
needs: testsuite | ||
runs-on: "self-hosted" | ||
steps: | ||
- name: Destroy Terraform environment | ||
if: always() | ||
run: terraform destroy --auto-approve | ||
working-directory: ${{ env.TERRAFORM_WORKING_DIR }} | ||
- name: "Destroy Terraform environment" | ||
if: "${{ always() }}" | ||
run: "terraform destroy --auto-approve" | ||
working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}" |