1- name : ' build-test'
1+ name : " build-test"
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 pull_request :
7- branches : [ main ]
7+ branches : [main]
88 workflow_dispatch :
99
1010jobs :
11- build : # make sure build/ci work properly
11+ build :
12+ # make sure build/ci work properly
1213 runs-on : ubuntu-latest
1314 env :
1415 MAYHEM_TOKEN : ${{ secrets.MAYHEM_TOKEN }}
2324 - run : |
2425 npm run all
2526
26- test-some-outputs : # make sure the action works on a clean machine without building
27+ test-some-outputs :
28+ # make sure the action works on a clean machine without building
2729 runs-on : ubuntu-latest
2830 steps :
2931 - uses : actions/checkout@v3
@@ -34,12 +36,13 @@ jobs:
3436 - uses : ./
3537 id : mcode-action
3638 with :
37- mayhem-url : https://beta.forallsecure.com
39+ mayhem-url : ${{ secrets.MAYHEM_URL }}
3840 mayhem-token : ${{ secrets.MAYHEM_TOKEN }}
3941 github-token : ${{ secrets.GITHUB_TOKEN }}
4042 sarif-output : out/sarif/
41- args : --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60
42-
43+ package : __tests__/lighttpd
44+ args : --image forallsecure/lighttpd:vulnerable --duration 60
45+
4346 - name : Upload SARIF file(s)
4447 uses : github/codeql-action/upload-sarif@v2
4548 with :
5053 [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1;
5154 echo "The run id was: ${{ steps.mcode-action.outputs.runId }}"
5255
53- test-all-outputs : # make sure the action works on a clean machine without building
56+ test-all-outputs :
57+ # make sure the action works on a clean machine without building
5458 runs-on : ubuntu-latest
5559 steps :
5660 - uses : actions/checkout@v3
@@ -61,13 +65,14 @@ jobs:
6165 - uses : ./
6266 id : mcode-action
6367 with :
64- mayhem-url : https://beta.forallsecure.com
68+ mayhem-url : ${{ secrets.MAYHEM_URL }}
6569 mayhem-token : ${{ secrets.MAYHEM_TOKEN }}
6670 github-token : ${{ secrets.GITHUB_TOKEN }}
6771 junit-output : out/junit/
6872 sarif-output : out/sarif/
6973 coverage-output : out/coverage/
70- args : --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60
74+ package : __tests__/lighttpd
75+ args : --image forallsecure/lighttpd:vulnerable --duration 60
7176
7277 - name : Archive Coverage report
7378 uses : actions/upload-artifact@v3
8287 name : mcode-junit
8388 path : out/junit/
8489 if-no-files-found : error
85-
90+
8691 - name : Upload SARIF file(s)
8792 uses : github/codeql-action/upload-sarif@v2
8893 with :
9398 [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1;
9499 echo "The run id was: ${{ steps.mcode-action.outputs.runId }}"
95100
96- test-no-outputs : # make sure the action works on a clean machine without building
101+ test-no-outputs :
102+ # make sure the action works on a clean machine without building
97103 runs-on : ubuntu-latest
98104 steps :
99105 - uses : actions/checkout@v3
@@ -104,10 +110,11 @@ jobs:
104110 - uses : ./
105111 id : mcode-action
106112 with :
107- mayhem-url : https://beta.forallsecure.com
113+ mayhem-url : ${{ secrets.MAYHEM_URL }}
108114 mayhem-token : ${{ secrets.MAYHEM_TOKEN }}
109115 github-token : ${{ secrets.GITHUB_TOKEN }}
110- args : --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60
116+ package : __tests__/lighttpd
117+ args : --image forallsecure/lighttpd:vulnerable --duration 60
111118
112119 - name : Print runId (${{ steps.mcode-action.outputs.runId }}) and test it's non-empty
113120 run : |
@@ -126,13 +133,14 @@ jobs:
126133 - uses : ./
127134 id : mcode-action
128135 with :
129- mayhem-url : https://beta.forallsecure.com
136+ mayhem-url : ${{ secrets.MAYHEM_URL }}
130137 mayhem-token : ${{ secrets.MAYHEM_TOKEN }}
131138 github-token : ${{ secrets.GITHUB_TOKEN }}
132- args : --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60
139+ package : __tests__/lighttpd
140+ args : --image forallsecure/lighttpd:vulnerable --duration 60
133141 # override the default owner which is forallsecure
134- # the secrets.MAYHEM_TOKEN is this case is owned by vlussenburg , which is why we choose that owner here
135- owner : vlussenburg
142+ # the secrets.MAYHEM_TOKEN is this case is owned by mcode-action , which is why we choose that owner here
143+ owner : mcode-action
136144 # override default verbosity which is info (contrary to what the `action.yml` says: https://github.com/ForAllSecure/mcode-action/blob/806778bb4a79d793f678087d0f9f3ff18f9a2d93/src/main.ts#L36)
137145 verbosity : debug
138146 # already covered and skipped in this test: mayhem-token, mayhem-url, github-token, sarif|junit|coverage-output, args
@@ -141,3 +149,32 @@ jobs:
141149 run : |
142150 [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1;
143151 echo "The run id was: ${{ steps.mcode-action.outputs.runId }}"
152+
153+ test-fail-on-defects :
154+ # make sure the action works on a clean machine without building
155+ runs-on : ubuntu-latest
156+ steps :
157+ - uses : actions/checkout@v3
158+ with :
159+ # fetch entire history to compute diffs between jobs
160+ fetch-depth : 0
161+
162+ - uses : ./
163+ id : mcode-action
164+ continue-on-error : true
165+ with :
166+ mayhem-url : ${{ secrets.MAYHEM_URL }}
167+ mayhem-token : ${{ secrets.MAYHEM_TOKEN }}
168+ github-token : ${{ secrets.GITHUB_TOKEN }}
169+ package : __tests__/mayhemit
170+ args : --image forallsecure/c-base-executable:latest --duration 60
171+ fail-on-defects : true
172+
173+ # Previous step should fail
174+ - name : Invert success and failure
175+ run : if [[ ${{ steps.mcode-action.outcome }} == "failure" ]]; then exit 0; else exit 1; fi
176+
177+ - name : Print runId (${{ steps.mcode-action.outputs.runId }}) and test it's non-empty
178+ run : |
179+ [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1;
180+ echo "The run id was: ${{ steps.mcode-action.outputs.runId }}"
0 commit comments