-
Notifications
You must be signed in to change notification settings - Fork 13
137 lines (119 loc) · 4.54 KB
/
sonarqube.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: SonarQube
on:
push:
branches:
- develop
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Scan
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [0, 1, 2, 3, 4] # Distribuirá la carga entre 5 contenedores para paralelismo
steps:
########################################
# Checkout and Build vue-form-elements
########################################
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup node env 🏗
uses: actions/setup-node@master
with:
node-version: 20
check-latest: true
cache: 'npm'
- name: Install vfe dependencies
run: npm ci && npm run build-bundle
- name: Link vue-form-elements
run: npm link
########################################
# Checkout and Build screen-builder
########################################
- name: Get screen-builder-version from PR body
uses: actions-ecosystem/action-regex-match@v2
id: screen-builder-version
with:
text: ${{ github.event.pull_request.body }}
regex: 'ci:screen-builder:([^\s]+)'
- name: Set env variable SCREEN_BUILDER_BRANCH (default=develop)
run: |
export SCREEN_BUILDER_BRANCH='develop'
if [[ ${{ contains(github.event.pull_request.body, 'ci:next') }} ]]; then
export SCREEN_BUILDER_BRANCH=next
fi
if [[ ${{ steps.screen-builder-version.outputs.match != '' }} ]]; then
export SCREEN_BUILDER_BRANCH=${{ steps.screen-builder-version.outputs.group1 }}
fi
echo "SCREEN_BUILDER_BRANCH=${SCREEN_BUILDER_BRANCH}" >> $GITHUB_ENV
- name: Checkout screen-builder
uses: actions/checkout@v4
with:
repository: ProcessMaker/screen-builder
path: screen-builder
ref: ${{ env.SCREEN_BUILDER_BRANCH }}
- name: Link vue-form-elements
working-directory: screen-builder
run: npm link @processmaker/vue-form-elements
- name: Install screen-builder dependencies
working-directory: screen-builder
run: npm ci && npm run build-bundle
########################################
# Run Cypress tests in parallel
########################################
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: screen-builder
browser: chrome
install: false
start: npm run dev
wait-on: 'http://localhost:5173/'
config-file: cypress.config.js
spec: "tests/e2e/**/*"
record: true
parallel: true # Habilita el paralelismo
group: "CI - Chrome - Container ${{ matrix.containers }}" # Identificar grupo de pruebas por contenedor
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
- name: Upload Cypress Screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: screen-builder/tests/e2e/screenshots
- name: Upload Cypress Videos
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: screen-builder/tests/e2e/videos
- name: Prepare coverage
working-directory: screen-builder
run: cp .nyc_output/out.json coverage/coverage-${{ matrix.containers }}.json
- name: Archive code coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.containers }}
path: ./screen-builder/coverage/coverage-${{ matrix.containers }}.json
- name: Create coverage report
working-directory: screen-builder
run: npx nyc report --reporter html --reporter text --reporter json-summary --reporter lcov --report-dir coverage
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: |
coverage
.nyc_output
reports
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}