-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (60 loc) · 2.69 KB
/
workflow-blacklist-academy-api-postman-newman.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Pipeline Testes Automatizados API REST ERP Qa.Coders Academy Postman
# executa o workflow toda vez que for realizado um push ou pull-request no repositório
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# permite também executar esse workflow manualmente na aba "Actions" do GitHub
workflow_dispatch:
jobs:
postman-api-rest:
# agente de execução/runner
runs-on: ubuntu-latest
steps:
- name: Passo 1 - Obter cópia do código-fonte do repositório
uses: actions/checkout@v3
- name: Passo 2 - Verificar versões do Node e Newman
run: |
node --version
newman --version
- name: Passo 3 - Instalar newman-reporter-htmlextra
run: sudo npm install -g newman-reporter-htmlextra
- name: Passo 4 - Executar com Newman testes automatizados de API REST no ambiente da squad "Black List" da collection e environment do Postman e Gerar report html
run: newman run ./blacklist-collection-sprints11,12,14.json -e ./blacklist-environment-sprints11,12,14.json --delay-request 2 --reporters cli, -r htmlextra --reporter-htmlextra-export ./reports/postman-api-rest-report-htmlextra-newman.html
- name: Passo 5 - Armazenar report html
uses: actions/upload-artifact@v3
# expressão condicional para que sempre seja executado independentemente dos resultados dos steps anteriores
if: ${{ always() }}
with:
name: postman-api-rest-report-html-newman
path: ./reports
# armazena o relatório html por 30 dias
retention-days: 30
deploy-github-pages:
# esse job "deploy-github-pages" somente é executado se o job anterior "postman-api-rest" for executado com sucesso
needs: postman-api-rest
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: https://andressakarla.github.io/blacklist-academy12.2-api-postman/postman-api-rest-report-htmlextra-newman.html
steps:
- name: Passo 1 - Configurar pages
uses: actions/configure-pages@v2
- name: Passo 2 - Baixar report html armazenado no job anterior "postman-api-rest"
uses: actions/download-artifact@v3
with:
name: postman-api-rest-report-html-newman
path: ./reports
- name: Passo 3 - Armazenar pages
uses: actions/upload-pages-artifact@v1
with:
path: ./reports
retention-days: 30
- name: Passo 4 - Deploy/Publicar no Github Pages na "url" configurada em "deploy-github-pages > environment"
id: deployment
uses: actions/deploy-pages@v1