Run Automated Tests and Upload to Xray #59
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: Run Automated Tests and Upload to Xray | |
on: | |
schedule: | |
- cron: "0 6 * * *" # Corre todos los días a las 6:00 AM | |
workflow_dispatch: # Permite ejecución manual desde la interfaz de GitHub Actions | |
env: | |
BASE_URL: ${{ secrets.BASE_URL }} | |
IMPORTS_URL: ${{ secrets.IMPORTS_URL }} | |
INVENTORY_URL: ${{ secrets.INVENTORY_URL }} | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest # El pipeline correrá en un contenedor de Ubuntu | |
steps: | |
# Paso 1: Checkout del repositorio | |
- name: Checkout repository | |
uses: actions/checkout@v3 # Este paso obtiene el código del repositorio | |
# Paso 2: Configurar Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" # Configura la versión de Python que se usará | |
# Paso 3: Instalar dependencias desde requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip # Asegura que pip esté actualizado | |
pip install -r requirements.txt # Instala las dependencias desde requirements.txt | |
#- name: Upload results to Xray | |
#env: | |
#AUTH_URL: ${{ secrets.AUTH_URL }} | |
#CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
# CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
# IMPORT_URL: ${{ secrets.IMPORT_URL }} | |
#run: | | |
#python xray_integration.py # Ejecuta el script para subir el archivo XML a Xray | |
# Paso 5: Ejecutar pruebas automatizadas | |
- name: Run tests | |
run: | | |
pytest -s # Ejecuta las pruebas y genera un archivo de resultados en formato XML pytest --junitxml=results.xml | |