-
Notifications
You must be signed in to change notification settings - Fork 38
171 lines (146 loc) · 8.17 KB
/
sca-scan.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
167
168
169
170
171
# SCA Scan
name: Software Composition Analysis
on:
# Runs when a pull request review is being submitted
pull_request:
types: [assigned,synchronize]
branches:
- 'main'
- 'v0.*'
- 'v2.x'
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
software-composition-analysis:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Code (Pull Request Into v2.x)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: recursive
- name: Checkout Code (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_to_test }}
repository: aiverify-foundation/aiverify
submodules: recursive
- name: Set Branch Variable (Pull Request Into v2.x)
if: github.event_name == 'pull_request'
run: |
echo "BRANCH=v2.x" >> "$GITHUB_ENV"
- name: Set Branch Variable (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo "BRANCH=v1.0" >> "$GITHUB_ENV"
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install & Scan APIGW (Pull Request Into v2.x)
if: github.event_name == 'pull_request'
run: |
cd aiverify-apigw
python3 -m venv venv
source venv/bin/activate
pip install -e .
pip freeze > requirements.txt
deactivate
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=aiverify-apigw --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="aiverify-apigw_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../
- name: Install & Scan APIGW (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd ai-verify-apigw
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=ai-verify-apigw --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="ai-verify-apigw_$BRANCH" --detect.excluded.directories=tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan PORTAL (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd ai-verify-portal
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=ai-verify-portal --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="ai-verify-portal_$BRANCH" --detect.excluded.directories=tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan SHARED LIBRARY (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd ai-verify-shared-library
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=ai-verify-shared-library --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="ai-verify-shared-library_$BRANCH" --detect.excluded.directories=tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan TEST ENGINE (Pull Request Into v2.x)
if: github.event_name == 'pull_request'
run: |
cd aiverify-test-engine
python3 -m venv venv
source venv/bin/activate
pip install -e .
pip freeze > requirements.txt
deactivate
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=aiverify-test-engine --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="aiverify-test-engine_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../
- name: Install & Scan TEST ENGINE (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd test-engine-app
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=test-engine-app --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="test-engine-app_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../
- name: Install & Scan TEST ENGINE CORE (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd test-engine-core
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=test-engine-core --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="test-engine-core_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../
- name: Install & Scan TEST ENGINE CORE MODULES (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
cd test-engine-core-modules
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=test-engine-core-modules --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="test-engine-core-modules_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../
- name: Install & Scan Accumulated Local Effects (Pull Request Into v2.x)
if: github.event_name == 'pull_request'
run: |
ls
cd stock-plugins/aiverify.stock.accumulated-local-effect/algorithms/accumulated-local-effect
python3 -m venv venv
source venv/bin/activate
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=0 --detect.project.name=accumulated_local_effect --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="accumulated_local_effect_$BRANCH" --detect.excluded.directories=venv,tests --blackduck.trust.cert=true
deactivate
cd ../