|
| 1 | +name: 'build-test' |
| 2 | +on: |
| 3 | + push |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: # make sure build/ci work properly |
| 7 | + runs-on: ubuntu-latest |
| 8 | + env: |
| 9 | + MAYHEM_TOKEN: ${{ secrets.MAYHEM_TOKEN }} |
| 10 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v3 |
| 13 | + with: |
| 14 | + # fetch entire history to compute diffs between jobs |
| 15 | + fetch-depth: 0 |
| 16 | + - run: | |
| 17 | + npm install |
| 18 | + - run: | |
| 19 | + npm run all |
| 20 | +
|
| 21 | + test-some-outputs: # make sure the action works on a clean machine without building |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + # fetch entire history to compute diffs between jobs |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - uses: ./ |
| 30 | + id: mcode-action |
| 31 | + with: |
| 32 | + mayhem-url: https://demo.forallsecure.com |
| 33 | + mayhem-token: ${{ secrets.MAYHEM_TOKEN }} |
| 34 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + sarif-output: out/sarif/ |
| 36 | + args: --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60 |
| 37 | + |
| 38 | + - name: Upload SARIF file(s) |
| 39 | + uses: github/codeql-action/upload-sarif@v2 |
| 40 | + with: |
| 41 | + sarif_file: out/sarif |
| 42 | + |
| 43 | + - name: Print runId (${{ steps.mcode-action.outputs.runId }}) and test it's non-empty |
| 44 | + run: | |
| 45 | + [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1; |
| 46 | + echo "The run id was: ${{ steps.mcode-action.outputs.runId }}" |
| 47 | +
|
| 48 | + test-all-outputs: # make sure the action works on a clean machine without building |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v3 |
| 52 | + with: |
| 53 | + # fetch entire history to compute diffs between jobs |
| 54 | + fetch-depth: 0 |
| 55 | + |
| 56 | + - uses: ./ |
| 57 | + id: mcode-action |
| 58 | + with: |
| 59 | + mayhem-url: https://demo.forallsecure.com |
| 60 | + mayhem-token: ${{ secrets.MAYHEM_TOKEN }} |
| 61 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + junit-output: out/junit/ |
| 63 | + sarif-output: out/sarif/ |
| 64 | + coverage-output: out/coverage/ |
| 65 | + args: --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60 |
| 66 | + |
| 67 | + - name: Archive Coverage report |
| 68 | + uses: actions/upload-artifact@v3 |
| 69 | + with: |
| 70 | + name: coverage-report |
| 71 | + path: out/coverage/ |
| 72 | + |
| 73 | + - name: Archive JUnit results |
| 74 | + uses: actions/upload-artifact@v3 |
| 75 | + with: |
| 76 | + name: mcode-junit |
| 77 | + path: out/junit/ |
| 78 | + |
| 79 | + - name: Upload SARIF file(s) |
| 80 | + uses: github/codeql-action/upload-sarif@v2 |
| 81 | + with: |
| 82 | + sarif_file: out/sarif |
| 83 | + |
| 84 | + - name: Print runId (${{ steps.mcode-action.outputs.runId }}) and test it's non-empty |
| 85 | + run: | |
| 86 | + [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1; |
| 87 | + echo "The run id was: ${{ steps.mcode-action.outputs.runId }}" |
| 88 | +
|
| 89 | + test-no-outputs: # make sure the action works on a clean machine without building |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v3 |
| 93 | + with: |
| 94 | + # fetch entire history to compute diffs between jobs |
| 95 | + fetch-depth: 0 |
| 96 | + |
| 97 | + - uses: ./ |
| 98 | + id: mcode-action |
| 99 | + with: |
| 100 | + mayhem-url: https://demo.forallsecure.com |
| 101 | + mayhem-token: ${{ secrets.MAYHEM_TOKEN }} |
| 102 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + args: --image forallsecure/lighttpd:vulnerable --file __tests__/Mayhemfile --duration 60 |
| 104 | + |
| 105 | + - name: Print runId (${{ steps.mcode-action.outputs.runId }}) and test it's non-empty |
| 106 | + run: | |
| 107 | + [ -z "${{ steps.mcode-action.outputs.runId }}" ] && echo "runId was blank!" && exit 1; |
| 108 | + echo "The run id was: ${{ steps.mcode-action.outputs.runId }}" |
0 commit comments