Skip to content

Commit fe99103

Browse files
authored
Merge branch 'main' into deps/cyclonedx-python-lib_11
Signed-off-by: Jan Kowalleck <[email protected]>
2 parents 1c026b5 + 0e3cd01 commit fe99103

File tree

5 files changed

+70
-30
lines changed

5 files changed

+70
-30
lines changed

.github/workflows/docker.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
# For details of what checks are run for PRs please refer below
219
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
320

@@ -31,7 +48,7 @@ jobs:
3148
steps:
3249
- name: Checkout code
3350
# see https://github.com/actions/checkout
34-
uses: actions/checkout@v4
51+
uses: actions/checkout@v5
3552
with:
3653
fetch-depth: 0
3754
- name: setup reports-dir
@@ -41,7 +58,6 @@ jobs:
4158
uses: actions/setup-python@v5
4259
with:
4360
python-version: ${{ env.PYTHON_VERSION }}
44-
architecture: 'x64'
4561
- name: Setup poetry ${{ env.POETRY_VERSION }}
4662
# see https://github.com/marketplace/actions/setup-poetry
4763
uses: Gr1N/setup-poetry@v9

.github/workflows/python.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# encoding: utf-8
2-
31
# This file is part of CycloneDX Python
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +15,9 @@
1715
# SPDX-License-Identifier: Apache-2.0
1816
# Copyright (c) OWASP Foundation. All Rights Reserved.
1917

18+
# For details of what checks are run for PRs please refer below
19+
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
20+
2021
name: Python CI
2122

2223
on:
@@ -51,13 +52,12 @@ jobs:
5152
steps:
5253
- name: Checkout
5354
# see https://github.com/actions/checkout
54-
uses: actions/checkout@v4
55+
uses: actions/checkout@v5
5556
- name: Setup Python Environment
5657
# see https://github.com/actions/setup-python
5758
uses: actions/setup-python@v5
5859
with:
5960
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
60-
architecture: 'x64'
6161
- name: Install poetry
6262
# see https://github.com/marketplace/actions/setup-poetry
6363
uses: Gr1N/setup-poetry@v9
@@ -75,13 +75,12 @@ jobs:
7575
steps:
7676
- name: Checkout
7777
# see https://github.com/actions/checkout
78-
uses: actions/checkout@v4
78+
uses: actions/checkout@v5
7979
- name: Setup Python Environment
8080
# see https://github.com/actions/setup-python
8181
uses: actions/setup-python@v5
8282
with:
8383
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
84-
architecture: 'x64'
8584
- name: Install poetry
8685
# see https://github.com/marketplace/actions/setup-poetry
8786
uses: Gr1N/setup-poetry@v9
@@ -99,13 +98,12 @@ jobs:
9998
steps:
10099
- name: Checkout
101100
# see https://github.com/actions/checkout
102-
uses: actions/checkout@v4
101+
uses: actions/checkout@v5
103102
- name: Setup Python Environment
104103
# see https://github.com/actions/setup-python
105104
uses: actions/setup-python@v5
106105
with:
107106
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
108-
architecture: 'x64'
109107
- name: Install poetry
110108
# see https://github.com/marketplace/actions/setup-poetry
111109
uses: Gr1N/setup-poetry@v9
@@ -133,13 +131,12 @@ jobs:
133131
steps:
134132
- name: Checkout
135133
# see https://github.com/actions/checkout
136-
uses: actions/checkout@v4
134+
uses: actions/checkout@v5
137135
- name: Setup Python Environment
138136
# see https://github.com/actions/setup-python
139137
uses: actions/setup-python@v5
140138
with:
141139
python-version: ${{ matrix.python-version }}
142-
architecture: 'x64'
143140
- name: Install poetry
144141
# see https://github.com/marketplace/actions/setup-poetry
145142
uses: Gr1N/setup-poetry@v9
@@ -157,13 +154,12 @@ jobs:
157154
steps:
158155
- name: Checkout
159156
# see https://github.com/actions/checkout
160-
uses: actions/checkout@v4
157+
uses: actions/checkout@v5
161158
- name: Setup Python Environment
162159
# see https://github.com/actions/setup-python
163160
uses: actions/setup-python@v5
164161
with:
165162
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
166-
architecture: 'x64'
167163
- name: Install poetry
168164
# see https://github.com/marketplace/actions/setup-poetry
169165
uses: Gr1N/setup-poetry@v9
@@ -191,13 +187,12 @@ jobs:
191187
steps:
192188
- name: Checkout
193189
# see https://github.com/actions/checkout
194-
uses: actions/checkout@v4
190+
uses: actions/checkout@v5
195191
- name: Setup Python Environment
196192
# see https://github.com/actions/setup-python
197193
uses: actions/setup-python@v5
198194
with:
199195
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
200-
architecture: 'x64'
201196
- name: Install self
202197
run: pip install .
203198
- name: run command
@@ -228,20 +223,30 @@ jobs:
228223
include:
229224
- os: macos-13
230225
python-version: "3.10"
226+
unittest-args: []
231227
- os: macos-13
232228
python-version: "3.9"
229+
unittest-args: []
233230
steps:
234231
- name: Checkout
235232
# see https://github.com/actions/checkout
236-
uses: actions/checkout@v4
233+
uses: actions/checkout@v5
237234
- name: Create reports directory
238235
run: mkdir ${{ env.REPORTS_DIR }}
239236
- name: Setup Python Environment
240237
# see https://github.com/actions/setup-python
241238
uses: actions/setup-python@v5
242239
with:
243240
python-version: ${{ matrix.python-version }}
244-
architecture: 'x64'
241+
- name: craft PY_UT_ARGS
242+
shell: python
243+
run: |-
244+
import sys, os
245+
PY_UT_ARGS=[]
246+
if sys.version_info >= (3, 12):
247+
PY_UT_ARGS.append('--durations=0')
248+
with open(os.environ['GITHUB_ENV'], 'a') as env_file:
249+
env_file.write(f'PY_UT_ARGS={" ".join(PY_UT_ARGS)}\n')
245250
- name: Install poetry
246251
# see https://github.com/marketplace/actions/setup-poetry
247252
uses: Gr1N/setup-poetry@v9
@@ -252,7 +257,7 @@ jobs:
252257
- name: Ensure build successful
253258
run: poetry build
254259
- name: Run tox
255-
run: poetry run tox r -e py -s false
260+
run: poetry run -- tox r -e py -s false -- $PY_UT_ARGS
256261
- name: Generate coverage reports
257262
if: ${{ failure() || success() }}
258263
shell: bash
@@ -277,7 +282,7 @@ jobs:
277282
steps:
278283
- name: fetch test artifacts
279284
# see https://github.com/actions/download-artifact
280-
uses: actions/download-artifact@v4
285+
uses: actions/download-artifact@v5
281286
with:
282287
pattern: '${{ env.TESTS_REPORTS_ARTIFACT }}_bnt_*'
283288
merge-multiple: true

.github/workflows/release.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
18+
# For details of what checks are run for PRs please refer below
19+
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
20+
121
name: Release
222

323
on:
@@ -51,13 +71,12 @@ jobs:
5171
steps:
5272
- name: Checkout code
5373
# see https://github.com/actions/checkout
54-
uses: actions/checkout@v4
74+
uses: actions/checkout@v5
5575
- name: Setup Python Environment
5676
# see https://github.com/actions/setup-python
5777
uses: actions/setup-python@v5
5878
with:
5979
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
60-
architecture: 'x64'
6180
- name: Install poetry
6281
# see https://github.com/marketplace/actions/setup-poetry
6382
uses: Gr1N/setup-poetry@v9
@@ -75,13 +94,12 @@ jobs:
7594
steps:
7695
- name: Checkout
7796
# see https://github.com/actions/checkout
78-
uses: actions/checkout@v4
97+
uses: actions/checkout@v5
7998
- name: Setup Python Environment
8099
# see https://github.com/actions/setup-python
81100
uses: actions/setup-python@v5
82101
with:
83102
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
84-
architecture: 'x64'
85103
- name: Install poetry
86104
# see https://github.com/marketplace/actions/setup-poetry
87105
uses: Gr1N/setup-poetry@v9
@@ -114,15 +132,14 @@ jobs:
114132
steps:
115133
- name: Checkout code
116134
# see https://github.com/actions/checkout
117-
uses: actions/checkout@v4
135+
uses: actions/checkout@v5
118136
with:
119137
fetch-depth: 0
120138
- name: Setup python
121139
# see https://github.com/actions/setup-python
122140
uses: actions/setup-python@v5
123141
with:
124142
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
125-
architecture: 'x64'
126143
- name: Install and configure Poetry
127144
# See https://github.com/marketplace/actions/install-poetry-action
128145
uses: snok/install-poetry@v1
@@ -203,7 +220,7 @@ jobs:
203220
echo "GHCR_REPO=${GHCR_REPO@L}" >> "${GITHUB_ENV}"
204221
- name: Checkout code (${{ env.TAG }})
205222
# see https://github.com/actions/checkout
206-
uses: actions/checkout@v4
223+
uses: actions/checkout@v5
207224
with:
208225
ref: ${{ needs.release-PyPI.outputs.tag }}
209226
- name: setup dirs
@@ -212,7 +229,7 @@ jobs:
212229
mkdir "$DIST_DIR"
213230
- name: Fetch python dist artifact
214231
# see https://github.com/actions/download-artifact
215-
uses: actions/download-artifact@v4
232+
uses: actions/download-artifact@v5
216233
with:
217234
name: ${{ env.DIST_ARTIFACT }}
218235
path: ${{ env.DIST_DIR }}/

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ tomli = { version = "^2.0.1", python = "<3.11" }
9696
tox = "4.27.0"
9797
pyupgrade = "3.20.0"
9898
deptry = "0.23.0"
99+
# for tests, use the GPL-version of jsonschema format validators - they are faster
100+
jsonschema = { version = "*", extras = ["format"] }
99101

100102
# min version required to be able to install some dependencies
101103
# see https://github.com/MichaelKim0407/flake8-use-fstring/issues/33

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ allowlist_externals = poetry
2323
## deps = poetry ## << this one caused https://github.com/python-poetry/poetry/issues/6288
2424
commands_pre =
2525
{envpython} --version
26-
poetry install --no-root -v
26+
# poetry install --no-root -v
2727
poetry run pip freeze
2828
commands =
29-
poetry run coverage run --source=cyclonedx_py -m unittest discover -t . -s tests -v
29+
poetry run coverage run --source=cyclonedx_py -m unittest discover -t . -s tests -v {posargs}
3030
setenv =
3131
PYTHONHASHSEED=0
3232
CDX_TEST_RECREATE_SNAPSHOTS={env:CDX_TEST_RECREATE_SNAPSHOTS:}

0 commit comments

Comments
 (0)