Skip to content

ci: add xml reporting(experimental) #542

ci: add xml reporting(experimental)

ci: add xml reporting(experimental) #542

name: Helm Charts Agent - Integration Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 6 * * *" #Runs at 06:00 UTC Daily
#Special permissions required for OIDC authentication
permissions:
id-token: write
contents: write
pull-requests: write
actions: write
checks: write
env:
TF_VAR_observe_url: ${{secrets.OBSERVE_URL}}
TF_VAR_observe_token: ${{secrets.OBSERVE_TOKEN}}
TF_VAR_helm_chart_agent_test_release_name: helm-charts-agent-gha-integration-tests
jobs:
helm-charts-agent-integration-tests:
name: ns-${{ matrix.namespace }}+values-${{ matrix.values }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
values:
- default.yaml
- node_affinity.yaml
- node_taint.yaml
namespace:
- observe
include: # Test not-observe namespace with default values only
- values: default.yaml
namespace: not-observe
defaults:
run:
working-directory: integration #Terraform commands and tests are ran from integration directory
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Terraform Variables for matrixing
run: |
echo "TF_VAR_helm_chart_agent_test_values_file=$(echo ${{matrix.values}})" >> $GITHUB_ENV
echo "TF_VAR_helm_chart_agent_test_namespace=$(echo ${{matrix.namespace}})" >> $GITHUB_ENV
- uses: azure/setup-kubectl@v4
with:
version: latest
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install -r scripts/requirements.txt
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with: #Use alpha version which has experimental Junit feature.
terraform_version: "1.10.0-alpha20240918"
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Test
id: test
run: |
terraform test -verbose -junit-xml=results-ns-${{ matrix.namespace }}+values-${{ matrix.values }}.xml
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: results-ns-${{ matrix.namespace }}+values-${{ matrix.values }}
path: ${{ github.workspace }}/integration/*.xml
- name: Publish Test Summary #Parses *xml file and sends summary to Github Summary Page.
uses: test-summary/action@v2
with:
paths: ${{ github.workspace }}/integration/*.xml
if: always()