Skip to content

Commit

Permalink
chore: use matrix
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
kzantow committed May 21, 2024
1 parent 47ac6a5 commit ff87f3f
Showing 1 changed file with 15 additions and 121 deletions.
136 changes: 15 additions & 121 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,132 +70,26 @@ jobs:
- name: Check Grype version after scan-action
run: grype version | egrep "^Version:.*0.54.0$"

test-image-input:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
image: alpine:latest
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-directory-input:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
path: tests/fixtures/npm-project
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-sbom-input:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
sbom: tests/fixtures/test_sbom.spdx.json
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-table-output:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
output-format: table
image: alpine:latest
fail-build: false

test-windows-image:
runs-on: windows-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
image: alpine:latest
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-windows-path:
runs-on: windows-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
path: tests/fixtures/npm-project
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarifs }}'

test-windows-json:
runs-on: windows-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
output-format: json
path: tests/fixtures/npm-project
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.json }}'

test-sarif-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
image: debian:8
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-sarif-directory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
path: tests/fixtures/npm-project
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.sarif }}'

test-json-directory:
runs-on: ubuntu-latest
test-matrix:
strategy:
matrix:
image: ['', alpine:latest]
path: ['', tests/fixtures/npm-project]
sbom: ['', tests/fixtures/test_sbom.spdx.json]
os: [ubuntu-latest, windows-latest, macos-latest]
output-format: [sarif, json, table]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
id: scan
with:
output-format: json
path: tests/fixtures/npm-project
image: ${{ matrix.image }}
path: ${{ matrix.path }}
sbom: ${{ matrix.sbom }}
output-format: ${{ matrix.output-format }}
fail-build: false

- name: Validate file exists
run: ls '${{ steps.scan.outputs.json }}'
if: ${{ matrix.output-format != 'table' }}
run: test -f '${{ steps.scan.outputs[matrix.output-format] }}'

0 comments on commit ff87f3f

Please sign in to comment.