1+ name : CI - Execução de Testes Automatizados
2+ run-name : Testes de CI com Robot Framework
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ jobs :
12+ testing :
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ test_type : [API, estruturas, escopos] # Adicione os tipos de teste que você deseja executar aqui
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+
21+ - name : Install Python 3.12.0
22+ uses : actions/setup-python@v4
23+ with :
24+ python-version : ' 3.12.0'
25+
26+ - name : Install dependencies
27+ run : |
28+ python -m pip install --upgrade pip
29+ python -m pip install --upgrade setuptools
30+ pip install -U -r requirements.txt
31+
32+ - name : Run tests
33+ run : |
34+ if [ "${{ matrix.test_type }}" == "API" ]; then
35+ robot -d ./resultados-testes-CI testes_API/tests
36+ elif [ "${{ matrix.test_type }}" == "estruturas" ]; then
37+ robot -d ./resultados-testes-CI -v HEADLESS:true -v BROWSER:chrome trabalhando_estruturas/tests
38+ elif [ "${{ matrix.test_type }}" == "escopos" ]; then
39+ robot -d ./resultados-testes-CI -e CT02 trabalhando_variaveis_escopos_argumentos/tests
40+ fi
41+
42+ - name : Upload test results
43+ if : always()
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : ${{ matrix.test_type }}_results
47+ path : ./resultados-testes-CI
48+ if-no-files-found : ignore
49+ retention-days : 2
50+
51+ - name : Download results
52+ if : always()
53+ uses : actions/download-artifact@v4
54+ with :
55+ name : ${{ matrix.test_type }}_results
56+ path : ./resultados/${{ matrix.test_type }}
57+
58+ - name : Debug - Verificar arquivos baixados
59+ if : always()
60+ run : ls -R ./resultados/${{ matrix.test_type }} || echo "Nenhum arquivo baixado!"
61+
62+ - name : Publicar Sumário no GitHub Actions
63+ if : always()
64+ run : |
65+ echo "## 📊 Resultados dos Testes Automatizados 🚀" >> $GITHUB_STEP_SUMMARY
66+ echo "- Tipo de teste: **${{ matrix.test_type }}**" >> $GITHUB_STEP_SUMMARY
67+ echo "- Status da execução: **${{ job.status == 'success' && '✅ Sucesso' || '❌ Falha' }}**" >> $GITHUB_STEP_SUMMARY
0 commit comments