-
Notifications
You must be signed in to change notification settings - Fork 9
184 lines (177 loc) · 5.34 KB
/
test.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
172
173
174
175
176
177
178
179
180
181
182
183
184
name: "action-tests"
on:
pull_request:
push:
branches:
- main
jobs:
# Run JS unit tests
unit-tests:
strategy:
matrix:
runner: [ 'ubuntu-latest', 'windows-latest' ]
name: Unit Tests
runs-on: ${{ matrix.runner }}
env:
SHAWK_API_KEY: ${{ secrets.HAWK_API_KEY }}
steps:
- uses: actions/checkout@v3
- run: npm install --only=dev
- run: npm run lint
- run: npm clean-install
- run: npm test
# Run a HawkScan with this Action
live-test:
strategy:
matrix:
runner: [ 'ubuntu-latest', 'windows-latest' ]
name: Live Test
runs-on: ${{ matrix.runner }}
steps:
- name: Check it out
uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run Scan
id: run-scan
uses: ./
with:
apiKey: ${{ secrets.HAWK_API_KEY }}
githubToken: ${{ github.token }}
configurationFiles: __tests__/stackhawk.yml
codeScanningAlerts: true
# Use the output from the `hello` step
- name: Check Scan Id
run: echo "The last scan id was ${{ steps.run-scan.outputs.scanId }}"
# Run a HawkScan with verbose and debug logging
verbose-debug-test:
name: Verbose and Debug Logging Test
strategy:
matrix:
runner: [ 'ubuntu-latest', 'windows-latest' ]
runs-on: ${{ matrix.runner }}
steps:
- name: Check it out
uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run Scan
uses: ./
with:
apiKey: ${{ secrets.HAWK_API_KEY }}
githubToken: ${{ github.token }}
configurationFiles: __tests__/stackhawk.yml
codeScanningAlerts: true
verbose: true
debug: true
# Run a HawkScan with this Action
command-line-test:
name: Command Line Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install CLI
uses: ./
with:
installCLIOnly: true
- name: Run the scan
run: hawk --api-key=${{ secrets.HAWK_API_KEY }} scan __tests__/stackhawk.yml
# Run a HawkScan with this Action
ajax-test:
name: Ajax Test
runs-on: ubuntu-20.04
steps:
- name: Check it out
uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run Scan
uses: ./
with:
apiKey: ${{ secrets.HAWK_API_KEY }}
githubToken: ${{ github.token }}
configurationFiles: __tests__/stackhawk.yml
codeScanningAlerts: true
javaspringvulny-test:
name: Java Spring Vulny Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Checkout javaspringvulny repository
uses: actions/checkout@v3
with:
repository: kaakaww/javaspringvulny
path: ./__tests__/integration-tests/apps/javaspringvulny
- name: Run javaspringvulny
run: |
cd __tests__/integration-tests/apps/javaspringvulny
docker-compose up -d
- name: Run HawkScan
id: run-hawkscan
uses: ./
with:
apiKey: ${{ secrets.HAWK_API_KEY }}
workspace: ${{ github.workspace }}/__tests__/integration-tests/configs/javaspringvulny/
configurationFiles: stackhawk-jsv-json-token.yml
# verbose: true
debug: true
env:
APPLICATION_ID: 4030d674-88b7-4e07-8065-7761f9c63788
- name: Run ReScan
uses: ./
with:
apiKey: ${{ secrets.HAWK_API_KEY }}
workspace: ${{ github.workspace }}/__tests__/integration-tests/configs/javaspringvulny/
configurationFiles: stackhawk-jsv-json-token.yml
command: rescan
args: |
--scan-id ${{ steps.run-hawkscan.outputs.scanId }}
env:
APPLICATION_ID: 4030d674-88b7-4e07-8065-7761f9c63788
# If there is a new version according to the .bumpversion.cfg file in the main branch, tag and release
release-new-version:
name: Release New Version
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs:
- unit-tests
- live-test
- ajax-test
- verbose-debug-test
- command-line-test
- javaspringvulny-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release Version
run: |
echo "RELEASE_VERSION=$(./scripts/version-check.sh)" >> $GITHUB_ENV
- name: Create Release
id: create_release
if: env.RELEASE_VERSION != ''
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_VERSION }}
release_name: HawkScan Action ${{ env.RELEASE_VERSION }}