chore: agregar .gitattributes y archivos de documentacion y tests de AR #27
This file contains hidden or 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: 🧪 Playwright Tests + Allure Report | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| test-and-deploy: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: 📥 Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: ⚙️ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - name: 📦 Install dependencies | |
| run: npm ci | |
| - name: 🎭 Install Playwright Browsers | |
| run: npx playwright install --with-deps | |
| - name: 🧪 Run Playwright tests | |
| run: npm test | |
| continue-on-error: true # permite continuar aunque haya tests fallidos | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| API_TOKEN: ${{ secrets.API_TOKEN }} | |
| # ── Historial Allure ───────────────────────────────────────────────────── | |
| # Descarga la rama gh-pages para recuperar el historial previo de Allure. | |
| # Sin este paso, las gráficas de tendencias solo muestran la ejecución actual. | |
| - name: 📥 Recuperar historial Allure de gh-pages | |
| uses: actions/checkout@v4 | |
| if: always() | |
| continue-on-error: true | |
| with: | |
| ref: gh-pages | |
| path: gh-pages-branch | |
| - name: 📋 Copiar historial previo al directorio de resultados | |
| if: always() | |
| continue-on-error: true | |
| run: | | |
| mkdir -p allure-results/history | |
| if [ -d "gh-pages-branch/history" ]; then | |
| cp -r gh-pages-branch/history/. allure-results/history/ | |
| echo "✅ Historial previo copiado correctamente" | |
| else | |
| echo "ℹ️ No existe historial previo (primera ejecución)" | |
| fi | |
| # ── Generación del reporte ─────────────────────────────────────────────── | |
| - name: 📊 Generar Allure Report | |
| if: always() | |
| run: | | |
| npx allure generate allure-results --clean -o allure-report | |
| echo "✅ Allure Report generado en ./allure-report" | |
| # ── Slack ──────────────────────────────────────────────────────────────── | |
| - name: 📢 Enviar notificación a Slack | |
| if: always() | |
| run: node notify-slack.js | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| # ── Deploy GitHub Pages ────────────────────────────────────────────────── | |
| # Publica el Allure Report estático en la rama gh-pages. | |
| # La URL resultante será: https://<usuario>.github.io/<repo>/ | |
| - name: 🚀 Deploy Allure Report a GitHub Pages | |
| if: always() | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./allure-report | |
| publish_branch: gh-pages | |
| commit_message: "ci: deploy allure report [${{ github.run_number }}] - ${{ github.event_name }}" |