-
Notifications
You must be signed in to change notification settings - Fork 3
156 lines (150 loc) · 5.07 KB
/
ci.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Checkmarx One Jetbrains Plugin CI
on: [ pull_request, workflow_dispatch ]
env:
CX_BASE_URI: ${{ secrets.CX_BASE_URI }}
CX_APIKEY: ${{ secrets.CX_APIKEY }}
CX_TENANT: ${{ secrets.CX_TENANT }}
CX_TEST_REPO: ${{ secrets.CX_TEST_REPO }}
CX_TEST_SCAN: ${{ secrets.CX_TEST_SCAN }}
CX_TEST_BRANCH: ${{ secrets.CX_TEST_BRANCH }}
CX_TEST_PROJECT: ${{ secrets.CX_TEST_PROJECT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CX_NOT_MATCH_TEST_PROJECT: ${{ secrets.CX_NOT_MATCH_TEST_PROJECT }}
CX_NOT_MATCH_TEST_BRANCH: ${{ secrets.CX_NOT_MATCH_TEST_BRANCH }}
CX_NOT_MATCH_TEST_SCAN_ID: ${{ secrets.CX_NOT_MATCH_TEST_SCAN_ID }}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
testUI:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/[email protected]
with:
distribution: zulu
java-version: 11
- name: Setup FFmpeg
uses: FedericoCarboni/setup-ffmpeg@583042d32dd1cabb8bd09df03bde06080da5c87c #v2.0.0
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
token: ${{ secrets.GITHUB_TOKEN }}
# Perform clean before testing
- name: Clean
run: ./gradlew clean
# Run IDEA prepared for UI testing
- name: Run IDE
run: |
mkdir -p build/reports
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x24 &
sleep 10
./gradlew -i runIdeForUiTests > idea.log 2>&1 &
# Wait for IDEA to be started
- name: Health Check
run: curl --fail -sv --retry "15" --retry-delay "10" --retry-connrefused "http://127.0.0.1:8580"
# Run tests
- name: Tests
run: |
export DISPLAY=:99.0
./gradlew test --info --tests com.checkmarx.intellij.ui*
- name: Move video
if: ${{ failure() }}
run: mv video build/reports
# Save report if tests fail
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-fails-report
path: |
build/reports
# Save idea log if tests fail
- name: Save idea log
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: idea.log
path: |
idea.log
testUnit:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/[email protected]
with:
distribution: zulu
java-version: 11
# Perform clean before testing
- name: Clean
run: ./gradlew clean
# Run tests
- name: Run Tests with coverage report
id: test_results
run: |
./gradlew test --tests "com.checkmarx.intellij.unit*" JacocoTestReport
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
# Save coverage report as an artifact
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: unit-coverage-report
path: build/reports/jacoco/test/html/
# Save report if tests fail
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-fails-report-integration
path: |
build/reports
testIntegration:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/[email protected]
with:
distribution: zulu
java-version: 11
# Perform clean before testing
- name: Clean
run: ./gradlew clean
# Run tests
- name: Run Tests with coverage report
id: test_results
run: |
./gradlew test --tests "com.checkmarx.intellij.integration.standard*" JacocoTestReport
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
# Save coverage report as an artifact
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: integration-coverage-report
path: build/reports/jacoco/test/html/
# Save report if tests fail
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-fails-report-integration
path: |
build/reports