Skip to content

Commit cb26062

Browse files
committed
ci: skip long tests if sbom too
1 parent 903af4a commit cb26062

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/testing.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ jobs:
7575
python-version: ${{ matrix.python }}
7676
cache: 'pip'
7777

78-
- name: "Set flag from Commit"
78+
- name: "Skip tests if this is an automated sbom job"
7979
env:
80-
COMMIT_VAR: ${{ startsWith(github.head_ref, 'chore-sbom-py') }}
80+
COMMIT_VAR: ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
8181
run: |
8282
if ${COMMIT_VAR} == true; then
8383
echo "sbom=true" >> $GITHUB_ENV
@@ -87,10 +87,6 @@ jobs:
8787
echo "sbom set to false"
8888
fi
8989
90-
- name: "Is this an sbom?"
91-
if: env.sbom
92-
run: echo "Yes, don't run tests"
93-
9490
- name: Get date
9591
id: get-date
9692
run: |
@@ -176,6 +172,19 @@ jobs:
176172
with:
177173
python-version: '3.10'
178174
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+
179188
- name: Get date
180189
id: get-date
181190
run: |
@@ -214,10 +223,13 @@ jobs:
214223
if_true: '1'
215224
if_false: '0'
216225
- name: Install cabextract
226+
if: env.sbom == false
217227
run: sudo apt-get update && sudo apt-get install cabextract
218228
- name: Install OS dependencies for testing PDF
229+
if: env.sbom == false
219230
run: sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
220231
- name: Install pdftotext, reportlab and cve-bin-tool
232+
if: env.sbom == false
221233
run: |
222234
python -m pip install --upgrade pip
223235
python -m pip install --upgrade setuptools
@@ -227,11 +239,13 @@ jobs:
227239
python -m pip install --upgrade -r dev-requirements.txt
228240
python -m pip install --editable .
229241
- name: Try single CLI run of tool
242+
if: env.sbom == false
230243
run: |
231244
[[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
232245
NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
233246
cp -r ~/.cache/cve-bin-tool cache
234247
- name: Run async tests
248+
if: env.sbom == false
235249
env:
236250
LONG_TESTS: ${{ steps.git-diff.outputs.value }}
237251
run: >
@@ -242,13 +256,15 @@ jobs:
242256
--ignore=test/test_html.py
243257
--ignore=test/test_json.py
244258
- name: Run synchronous tests
259+
if: env.sbom == false
245260
env:
246261
LONG_TESTS: ${{ steps.git-diff.outputs.value }}
247262
run: >
248263
pytest -v --cov --cov-append --cov-report=xml
249264
test/test_cli.py
250265
test/test_cvedb.py
251266
- name: Upload code coverage to codecov
267+
if: env.sbom == false
252268
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
253269
with:
254270
files: ./coverage.xml

0 commit comments

Comments
 (0)