lint adjustments #98
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: workflow-pipeline | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| # Permissões necessárias para o deploy no GitHub Pages via Token | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| # ================================================================== | |
| # PARTE 1: RODAR TESTES (PARALELO) | |
| # ================================================================== | |
| # 1. API TESTS | |
| api-tests: | |
| name: ⚡ API Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: 18, cache: "npm" } | |
| - run: npm ci | |
| - run: npx playwright install --with-deps | |
| - name: Run API Tests | |
| run: npm run test:api | |
| env: | |
| API_BASE_URL: ${{ secrets.API_BASE_URL }} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: allure-api | |
| path: allure-results/ | |
| retention-days: 1 | |
| # 2. E2E TESTS (Cucumber) | |
| e2e-tests: | |
| name: 🖥️ E2E w/ IA | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v3 | |
| with: { distribution: "temurin", java-version: "17" } | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: 18, cache: "npm" } | |
| - run: npm ci | |
| - run: npx playwright install --with-deps chromium | |
| - name: Run E2E Tests | |
| run: npm run test:e2e | |
| env: | |
| # 🤖 INJEÇÃO DA IA AQUI! | |
| AZURE_AI_TOKEN: ${{ secrets.AZURE_AI_TOKEN }} | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
| SAUCE_PASSWORD: ${{ secrets.SAUCE_PASSWORD }} | |
| CI: "true" # Garante modo Headless | |
| # Upload do JSON para o Allure | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: allure-e2e | |
| path: allure-results/ | |
| retention-days: 1 | |
| # Upload do HTML do Cucumber (Para o link direto) | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cucumber-report-html | |
| path: cucumber-report.html | |
| retention-days: 1 | |
| # 3. MOBILE TESTS | |
| mobile-tests: | |
| name: 📱 Mobile Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: 18, cache: "npm" } | |
| - run: npm ci | |
| - run: npx playwright install --with-deps | |
| - name: Run Mobile Tests | |
| run: npx playwright test tests/mobile --project='Mobile' | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: allure-mobile | |
| path: allure-results/ | |
| retention-days: 1 | |
| # 4. VISUAL TESTS | |
| visual-tests: | |
| name: 🎨 Visual Regression | |
| runs-on: ubuntu-latest | |
| container: | |
| image: mcr.microsoft.com/playwright:v1.40.0-jammy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: 18 } | |
| - run: npm ci | |
| - name: Run Visual Tests | |
| run: npx playwright test --project='Visual Regression' | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: allure-visual | |
| path: allure-results/ | |
| retention-days: 1 | |
| # 5. LOAD TESTS (K6) | |
| load-tests: | |
| name: 🚀 K6 Load | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: 18 } | |
| - run: npm ci | |
| - uses: grafana/setup-k6-action@v1 | |
| - name: Run Load Tests | |
| run: | | |
| docker compose -f tests/k6-load/docker-compose.yml up -d influxdb grafana | |
| sleep 15 | |
| npm run k6:ci | |
| docker compose -f tests/k6-load/docker-compose.yml down | |
| env: | |
| K6_BASE_URL: ${{ secrets.K6_BASE_URL }} | |
| - name: Prepare K6 Report | |
| if: always() | |
| run: | | |
| mkdir -p k6-temp | |
| # Garante que pegamos o relatório onde quer que ele tenha sido gerado | |
| mv tests/k6-load/dist/report.html k6-temp/index.html || mv report.html k6-temp/index.html | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: k6-report | |
| path: k6-temp/ | |
| retention-days: 1 | |
| # ================================================================== | |
| # PARTE 2: DEPLOY UNIFICADO (ALLURE + CUCUMBER + K6) | |
| # ================================================================== | |
| report-deploy: | |
| name: 📊 Publish Unified Report | |
| if: always() | |
| needs: [api-tests, e2e-tests, mobile-tests, visual-tests, load-tests] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 1. Baixa todos os artefatos gerados pelos jobs anteriores | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| # 2. Consolida os resultados do Allure | |
| - name: Merge Allure Results | |
| run: | | |
| mkdir -p allure-results | |
| cp artifacts/allure-api/* allure-results/ || true | |
| cp artifacts/allure-e2e/* allure-results/ || true | |
| cp artifacts/allure-mobile/* allure-results/ || true | |
| cp artifacts/allure-visual/* allure-results/ || true | |
| # Copia as configs de ambiente para o Allure | |
| cp environment.properties allure-results/ || true | |
| cp categories.json allure-results/ || true | |
| # 3. Gera o Relatório HTML do Allure | |
| - name: Generate Unified Allure Report | |
| uses: simple-elf/allure-report-action@master | |
| with: | |
| allure_results: allure-results | |
| allure_history: allure-history | |
| keep_reports: 20 | |
| # 4. Organiza a pasta PUBLIC (que vai para o site) | |
| - name: Organize Reports for Web | |
| run: | | |
| mkdir -p public | |
| # --- A. Allure na Raiz --- | |
| cp -r allure-report/* public/ | |
| # --- B. K6 na subpasta /k6 --- | |
| mkdir -p public/k6 | |
| cp -r artifacts/k6-report/* public/k6/ | |
| # --- C. Cucumber na subpasta /cucumber --- | |
| mkdir -p public/cucumber | |
| # Renomeia para index.html para abrir direto no link | |
| mv artifacts/cucumber-report-html/cucumber-report.html public/cucumber/index.html | |
| # 5. Prepara o upload para o GitHub Pages | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: public | |
| # 6. Deploy Oficial | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # 7. Resumo com Links Dinâmicos | |
| - name: 📢 Summary Links | |
| run: | | |
| # URL base do GitHub Pages | |
| PAGES_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}" | |
| echo "### 📊 Central de Relatórios Unificada" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Tipo de Teste | Status | Link de Acesso |" >> $GITHUB_STEP_SUMMARY | |
| echo "| :--- | :--- | :--- |" >> $GITHUB_STEP_SUMMARY | |
| echo "| 🏅 **QA Dashboard (Geral)** | ✅ Gerado | [**Ver Allure Report**]($PAGES_URL/) |" >> $GITHUB_STEP_SUMMARY | |
| echo "| 🥒 **E2E (Detalhado)** | ✅ Gerado | [**Ver Cucumber BDD**]($PAGES_URL/cucumber/) |" >> $GITHUB_STEP_SUMMARY | |
| echo "| 🚀 **Performance (K6)** | ✅ Gerado | [**Ver K6 Metrics**]($PAGES_URL/k6/) |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "> *Nota: Se a página der 404 nos primeiros segundos, aguarde o deploy finalizar.*" >> $GITHUB_STEP_SUMMARY |