-
Notifications
You must be signed in to change notification settings - Fork 22
166 lines (147 loc) · 5.99 KB
/
functional-tests.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
157
158
159
160
161
162
163
164
165
166
name: Functional Tests
on:
workflow_dispatch:
inputs:
runId: # Accessible through ${{ inputs.runId }}
description: 'Required "Build and release"" workflow run id (see id in browser URL for selected run) from which to get artifacts to be tested'
required: true
type: number
workflow_run:
workflows: [Build and release]
types: [completed]
jobs:
ft-core:
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
type: [java, jar, native]
runs-on: ${{ matrix.os }}
steps:
# Java is required for running the functional tests
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Get artifacts from triggering workflow
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
name: combined-artifacts
path: ./artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts from specified workflow
if: github.event_name == 'workflow_dispatch'
uses: actions/download-artifact@v4
with:
run-id: ${{ inputs.runId }}
name: combined-artifacts
path: ./artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: List artifact contents
shell: bash
run: find ./artifacts
- name: Run Tests
shell: bash
run: |
mv artifacts/release-assets/* .
mv artifacts/fcli-ftest.jar .
case "${{ matrix.type }}" in
"java" )
java -jar fcli-ftest.jar -Dft.fcli=build -Dft.run=core,config,tool ;;
"jar" )
java -jar fcli-ftest.jar -Dft.fcli=fcli.jar -Dft.run=core,config,tool ;;
"native" )
case "${{ matrix.os }}" in
"ubuntu-latest" )
tar -zxvf fcli-linux.tgz
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=core,config,tool ;;
"windows-latest" )
7z e fcli-windows.zip
java -jar fcli-ftest.jar -Dft.fcli=fcli.exe -Dft.run=core,config,tool ;;
"macos-latest" )
tar -zxvf fcli-mac.tgz
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=core,config,tool ;;
esac ;;
esac
- name: Rename test log
if: always()
shell: bash
run: mv test.log "test-${{ matrix.os }}-${{ matrix.type }}.log"
- name: Publish test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-log-${{ matrix.os }}-${{ matrix.type }}
path: test-*.log
ft-product:
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
type: [fod, ssc, sc-sast, sc-dast, report]
runs-on: ubuntu-latest
steps:
# Java is required for running the functional tests
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Get artifacts from triggering workflow
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
name: combined-artifacts
path: ./artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts from specified workflow
if: github.event_name == 'workflow_dispatch'
uses: actions/download-artifact@v4
with:
run-id: ${{ inputs.runId }}
name: combined-artifacts
path: ./artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Tests
shell: bash
run: |
mv artifacts/release-assets/* .
mv artifacts/fcli-ftest.jar .
tar -zxvf fcli-linux.tgz
# Although we only run the current matrix entry type, we pass connection
# options for all session types, as some SC-SAST/SC-DAST tests may also
# require an SSC session.
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=$type \
-Dft.fod.url=$fod_url -Dft.fod.tenant=$fod_tenant -Dft.fod.user=$fod_user -Dft.fod.password=$fod_pwd \
-Dft.ssc.url=$ssc_url -Dft.ssc.user=$ssc_user -Dft.ssc.password=$ssc_pwd \
-Dft.sc-sast.ssc-url=$ssc_url -Dft.sc-sast.ssc-user=$ssc_user -Dft.sc-sast.ssc-password=$ssc_pwd \
-Dft.sc-dast.ssc-url=$ssc_url -Dft.sc-dast.ssc-user=$ssc_user -Dft.sc-dast.ssc-password=$ssc_pwd \
-Dft.sc-sast.client-auth-token=$scsast_token
env:
type: ${{ matrix.type }}
fod_url: ${{ secrets.FCLI_FT_FOD_URL }}
fod_tenant: ${{ secrets.FCLI_FT_FOD_TENANT }}
fod_user: ${{ secrets.FCLI_FT_FOD_USER }}
fod_pwd: ${{ secrets.FCLI_FT_FOD_PWD }}
ssc_url: ${{ secrets.FCLI_FT_SSC_URL }}
ssc_user: ${{ secrets.FCLI_FT_SSC_USER }}
ssc_pwd: ${{ secrets.FCLI_FT_SSC_PWD }}
scsast_token: ${{ secrets.FCLI_FT_SCSAST_TOKEN }}
# Pass GitHub and GitLab tokens for use by NCD license report tests
FCLI_FT_GITHUB_TOKEN: ${{ secrets.FCLI_FT_GITHUB_TOKEN }}
FCLI_FT_GITLAB_TOKEN: ${{ secrets.FCLI_FT_GITLAB_TOKEN }}
- name: Rename test log
if: always()
shell: bash
run: mv test.log "test-${{ matrix.os }}-${{ matrix.type }}.log"
- name: Publish test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-log-${{ matrix.type }}
path: test-*.log