7474 with :
7575 python-version : ${{ matrix.python }}
7676 cache : ' pip'
77+
78+ - name : " Skip tests if this is an automated sbom job"
79+ env :
80+ COMMIT_VAR : ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
81+ run : |
82+ if ${COMMIT_VAR} == true; then
83+ echo "sbom=true" >> $GITHUB_ENV
84+ echo "sbom set to true"
85+ else
86+ echo "sbom=false" >> $GITHUB_ENV
87+ echo "sbom set to false"
88+ fi
89+
7790 - name : Get date
7891 id : get-date
7992 run : |
@@ -96,10 +109,13 @@ jobs:
96109 path : cache
97110 key : Linux-cve-bin-tool-${{ steps.get-date.outputs.yesterday }}
98111 - name : Install cabextract
112+ if : env.sbom == false
99113 run : sudo apt-get update && sudo apt-get install cabextract
100114 - name : Install OS dependencies for testing PDF
115+ if : env.sbom == false
101116 run : sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
102117 - name : Install pdftotext, reportlab and cve-bin-tool
118+ if : env.sbom == false
103119 run : |
104120 python -m pip install --upgrade pip
105121 python -m pip install --upgrade setuptools
@@ -109,11 +125,13 @@ jobs:
109125 python -m pip install --upgrade -r dev-requirements.txt
110126 python -m pip install --upgrade .
111127 - name : Try single CLI run of tool
128+ if : env.sbom == false
112129 run : |
113130 [[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
114131 NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
115132 cp -r ~/.cache/cve-bin-tool cache
116133 - name : Run async tests
134+ if : env.sbom == false
117135 run : >
118136 pytest -n 4 -v
119137 --ignore=test/test_cli.py
@@ -122,13 +140,23 @@ jobs:
122140 --ignore=test/test_html.py
123141 --ignore=test/test_json.py
124142 - name : Run synchronous tests
143+ if : env.sbom == false
125144 run : >
126145 pytest -v
127146 test/test_cli.py
128147 test/test_cvedb.py
129148
130149 long_tests :
131150 name : Long tests on Python 3.10
151+ if : |
152+ ! github.event.pull_request.user.login == 'github-actions[bot]' ||
153+ ! (
154+ startsWith(github.head_ref, 'chore-sbom-py') ||
155+ contains(
156+ fromJSON('["chore-update-table","chore-precommit-config","chore-spdx-header"]'),
157+ github.head_ref
158+ )
159+ )
132160 runs-on : ubuntu-22.04
133161 timeout-minutes : 90
134162 env :
@@ -144,6 +172,19 @@ jobs:
144172 with :
145173 python-version : ' 3.10'
146174 cache : ' pip'
175+
176+ - name : " Skip tests if this is an automated sbom job"
177+ env :
178+ COMMIT_VAR : ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
179+ run : |
180+ if ${COMMIT_VAR} == true; then
181+ echo "sbom=true" >> $GITHUB_ENV
182+ echo "sbom set to true"
183+ else
184+ echo "sbom=false" >> $GITHUB_ENV
185+ echo "sbom set to false"
186+ fi
187+
147188 - name : Get date
148189 id : get-date
149190 run : |
@@ -182,10 +223,13 @@ jobs:
182223 if_true : ' 1'
183224 if_false : ' 0'
184225 - name : Install cabextract
226+ if : env.sbom == false
185227 run : sudo apt-get update && sudo apt-get install cabextract
186228 - name : Install OS dependencies for testing PDF
229+ if : env.sbom == false
187230 run : sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
188231 - name : Install pdftotext, reportlab and cve-bin-tool
232+ if : env.sbom == false
189233 run : |
190234 python -m pip install --upgrade pip
191235 python -m pip install --upgrade setuptools
@@ -195,11 +239,13 @@ jobs:
195239 python -m pip install --upgrade -r dev-requirements.txt
196240 python -m pip install --editable .
197241 - name : Try single CLI run of tool
242+ if : env.sbom == false
198243 run : |
199244 [[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
200245 NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
201246 cp -r ~/.cache/cve-bin-tool cache
202247 - name : Run async tests
248+ if : env.sbom == false
203249 env :
204250 LONG_TESTS : ${{ steps.git-diff.outputs.value }}
205251 run : >
@@ -210,13 +256,15 @@ jobs:
210256 --ignore=test/test_html.py
211257 --ignore=test/test_json.py
212258 - name : Run synchronous tests
259+ if : env.sbom == false
213260 env :
214261 LONG_TESTS : ${{ steps.git-diff.outputs.value }}
215262 run : >
216263 pytest -v --cov --cov-append --cov-report=xml
217264 test/test_cli.py
218265 test/test_cvedb.py
219266 - name : Upload code coverage to codecov
267+ if : env.sbom == false
220268 uses : codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
221269 with :
222270 files : ./coverage.xml
0 commit comments