Skip to content

Testing Framework

Testing Framework #3

name: Testing Framework
on:
schedule: # schedule the job to run once a day
- cron: '0 0 * * *'
#workflow_dispatch:
# pull_request: ## temporary for debugging development purposes
# branches:
# - main
env:
TF_VAR_aws_region: "eu-west-2"
TF_VAR_aws_ami_owners: '["125523088429"]'
TF_VAR_aws_ami_name: '["Fedora-Cloud-Base-39*"]'
TF_VAR_aws_volume_size: 100
TF_VAR_aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
TF_VAR_aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: "eu-west-2"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
integration-tests:
if: github.repository == 'containers/ai-lab-recipes'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
aws_image_type: t3a.medium
aws_ami_architecture: x86_64
- arch: arm64
aws_image_type: m7g.medium
aws_ami_architecture: arm64
- arch: amd64 # gpu enabled
aws_image_type: g4dn.xlarge
aws_ami_architecture: x86_64
steps:
- name: Checkout
uses: actions/[email protected]
with:
path: main
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Python dependencies for otel trace generation
run: |
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
- name: Configure OpenTelemetry Collector
run: |
echo '
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
http:
endpoint: "0.0.0.0:4318"
exporters:
otlphttp:
endpoint: https://apps.platform-sts.pcbk.p1.openshiftapps.com
tls:
insecure: false
cert_pem: ${{ secrets.CLIENT_CERT_ROSA_OTEL }}
key_pem: ${{ secrets.CLIENT_KEY_ROSA_OTEL }}
ca_pem: ${{ secrets.SERVER_CERT_ROSA_OTEL }}
logging:
verbosity: detailed
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging,otlphttp]
' > otel-collector-config.yaml
- name: Run OpenTelemetry Collector
run: |
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.102.1/otelcol_0.102.1_linux_amd64.tar.gz
tar -xvf otelcol_0.102.1_linux_amd64.tar.gz
chmod +x otelcol
./otelcol --config otel-collector-config.yaml &
- name: Start integration-tests trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="integration-tests"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Checkout terraform module
id: checkout-module
uses: actions/[email protected]
with:
repository: containers/terraform-test-environment-module
path: terraform-test-environment-module
ref: 'main'
- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: "1.7.5"
terraform_wrapper: false
- name: Init
run: terraform init
working-directory: terraform-test-environment-module
- name: Start bootstrap trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="bootstrap"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Bootstrap
id: up
run: terraform apply -auto-approve -lock=false
working-directory: terraform-test-environment-module
env:
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
- name: End bootstrap trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="bootstrap"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Terraform Output
id: terraform-output
run: |
echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT
echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT
echo "pem_filename=$(terraform output pem_filename | xargs)" >> $GITHUB_OUTPUT
working-directory: terraform-test-environment-module
- name: Ansible Collections
run: ansible-galaxy install -r ./provision/requirements.yml
working-directory: ./main/recipes/natural_language_processing/chatbot
- name: Start ansible provision trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="ansible-provision"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Provision
run: |
ansible-playbook ./main/recipes/natural_language_processing/chatbot/provision/playbook.yml \
-i terraform-test-environment-module/hosts.ini \
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }}
env:
ANSIBLE_HOST_KEY_CHECKING: false
- name: End ansible provision trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="ansible-provision"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Install Dependencies
working-directory: ./main/recipes/natural_language_processing/chatbot
run: make install
- name: Start integration test trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="run-integration-tests"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Run Integration Tests
working-directory: ./main/recipes/natural_language_processing/chatbot
run: make integration-tests
env:
URL: ${{ steps.terraform-output.outputs.url }}
- name: End integration test trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="run-integration-tests"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Destroy Test Environment
id: down
if: always()
run: terraform destroy -auto-approve -lock=false
working-directory: terraform-test-environment-module
env:
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
- name: Publish Job Results to Slack
id: slack
if: always()
uses: slackapi/[email protected]
with:
payload: |
{
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Stop testing_framework trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="integration-tests"
export TRACE_ACTION="end"
python ci/trace-steps.py
release-images:
runs-on: ubuntu-24.04
needs: integration-tests
if: success()
strategy:
fail-fast: false
matrix:
include:
- image: llamacpp_python
- image: whispercpp
- image: chatbot
steps:
- name: Login to registry
uses: redhat-actions/[email protected]
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Copy image from one registry to another one
run: skopeo copy --all docker://${{ env.SOURCE_REGISTRY }}/${{ matrix.image }} docker://${{ env.TARGET_REGISTRY }}/${{ matrix.image }}
env:
SOURCE_REGISTRY: ghcr.io/containers
TARGET_REGISTRY: quay.io/ai-lab
- name: Publish Job Results to Slack
id: slack
if: always()
uses: slackapi/[email protected]
with:
payload: |
{
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
test-make-targets:
if: github.repository == 'containers-mirror/ai-lab-recipes'
runs-on: ubuntu-22.04-2core
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Python dependencies for otel trace generation
run: |
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
- name: Configure OpenTelemetry Collector
run: |
echo '
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
exporters:
logging:
loglevel: debug
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging]
' > otel-collector-config.yaml
- name: Run OpenTelemetry Collector
run: |
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.102.1/otelcol_0.102.1_linux_amd64.tar.gz
tar -xvf otelcol_0.102.1_linux_amd64.tar.gz
chmod +x otelcol
./otelcol --config otel-collector-config.yaml &
- name: Start chatbot make bootc trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="test-make-targets"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: chatbot
working-directory: ./recipes/natural_language_processing/chatbot
run: make bootc
- name: End chatbot make bootc trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="test-make-targets"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Publish Job Results to Slack
id: slack
if: always()
uses: slackapi/[email protected]
with:
payload: |
{
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}