4242 - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4343 - uses : actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
4444 with :
45- python-version : ' 3.x '
45+ python-version : ' 3.11 '
4646 cache : ' pip'
4747 cache-dependency-path : ' doc/requirements.txt'
4848 - name : Install doc dependencies
@@ -58,19 +58,11 @@ jobs:
5858
5959 tests :
6060 name : Linux tests
61- if : |
62- ! github.event.pull_request.user.login == 'github-actions[bot]' ||
63- ! (
64- startsWith(github.head_ref, 'chore-sbom-py') ||
65- contains(
66- fromJSON('["chore-update-table","chore-precommit-config","chore-spdx-header"]'),
67- github.head_ref
68- )
69- )
7061 runs-on : ubuntu-22.04
7162 strategy :
7263 matrix :
7364 python : ['3.8', '3.9', '3.11']
65+ # python 3.12 throws aiohttp package install errors
7466 timeout-minutes : 60
7567 steps :
7668 - name : Harden Runner
8375 with :
8476 python-version : ${{ matrix.python }}
8577 cache : ' pip'
78+
79+ - name : " Skip tests if this is an automated sbom job"
80+ env :
81+ COMMIT_VAR : ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
82+ run : |
83+ if ${COMMIT_VAR} == true; then
84+ echo "sbom=true" >> $GITHUB_ENV
85+ echo "sbom set to true"
86+ else
87+ echo "sbom=false" >> $GITHUB_ENV
88+ echo "sbom set to false"
89+ fi
90+
8691 - name : Get date
8792 id : get-date
8893 run : |
@@ -105,10 +110,13 @@ jobs:
105110 path : cache
106111 key : Linux-cve-bin-tool-${{ steps.get-date.outputs.yesterday }}
107112 - name : Install cabextract
113+ if : env.sbom == false
108114 run : sudo apt-get update && sudo apt-get install cabextract
109115 - name : Install OS dependencies for testing PDF
116+ if : env.sbom == false
110117 run : sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
111118 - name : Install pdftotext, reportlab and cve-bin-tool
119+ if : env.sbom == false
112120 run : |
113121 python -m pip install --upgrade pip
114122 python -m pip install --upgrade setuptools
@@ -118,11 +126,13 @@ jobs:
118126 python -m pip install --upgrade -r dev-requirements.txt
119127 python -m pip install --upgrade .
120128 - name : Try single CLI run of tool
129+ if : env.sbom == false
121130 run : |
122131 [[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
123132 NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
124133 cp -r ~/.cache/cve-bin-tool cache
125134 - name : Run async tests
135+ if : env.sbom == false
126136 run : >
127137 pytest -n 4 -v
128138 --ignore=test/test_cli.py
@@ -131,6 +141,7 @@ jobs:
131141 --ignore=test/test_html.py
132142 --ignore=test/test_json.py
133143 - name : Run synchronous tests
144+ if : env.sbom == false
134145 run : >
135146 pytest -v
136147 test/test_cli.py
@@ -162,6 +173,19 @@ jobs:
162173 with :
163174 python-version : ' 3.10'
164175 cache : ' pip'
176+
177+ - name : " Skip tests if this is an automated sbom job"
178+ env :
179+ COMMIT_VAR : ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
180+ run : |
181+ if ${COMMIT_VAR} == true; then
182+ echo "sbom=true" >> $GITHUB_ENV
183+ echo "sbom set to true"
184+ else
185+ echo "sbom=false" >> $GITHUB_ENV
186+ echo "sbom set to false"
187+ fi
188+
165189 - name : Get date
166190 id : get-date
167191 run : |
@@ -200,10 +224,13 @@ jobs:
200224 if_true : ' 1'
201225 if_false : ' 0'
202226 - name : Install cabextract
227+ if : env.sbom == false
203228 run : sudo apt-get update && sudo apt-get install cabextract
204229 - name : Install OS dependencies for testing PDF
230+ if : env.sbom == false
205231 run : sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
206232 - name : Install pdftotext, reportlab and cve-bin-tool
233+ if : env.sbom == false
207234 run : |
208235 python -m pip install --upgrade pip
209236 python -m pip install --upgrade setuptools
@@ -213,11 +240,13 @@ jobs:
213240 python -m pip install --upgrade -r dev-requirements.txt
214241 python -m pip install --editable .
215242 - name : Try single CLI run of tool
243+ if : env.sbom == false
216244 run : |
217245 [[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
218246 NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
219247 cp -r ~/.cache/cve-bin-tool cache
220248 - name : Run async tests
249+ if : env.sbom == false
221250 env :
222251 LONG_TESTS : ${{ steps.git-diff.outputs.value }}
223252 run : >
@@ -228,13 +257,15 @@ jobs:
228257 --ignore=test/test_html.py
229258 --ignore=test/test_json.py
230259 - name : Run synchronous tests
260+ if : env.sbom == false
231261 env :
232262 LONG_TESTS : ${{ steps.git-diff.outputs.value }}
233263 run : >
234264 pytest -v --cov --cov-append --cov-report=xml
235265 test/test_cli.py
236266 test/test_cvedb.py
237267 - name : Upload code coverage to codecov
268+ if : env.sbom == false
238269 uses : codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
239270 with :
240271 files : ./coverage.xml
0 commit comments