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");
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+
2021name : Python CI
2122
2223on :
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
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
@@ -105,7 +104,6 @@ jobs:
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
@@ -139,7 +137,6 @@ jobs:
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
@@ -163,7 +160,6 @@ jobs:
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
@@ -197,7 +193,6 @@ jobs:
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
@@ -206,7 +201,7 @@ jobs:
206201 build-and-test :
207202 name : Test (${{ matrix.os }} py${{ matrix.python-version }})
208203 runs-on : ${{ matrix.os }}
209- timeout-minutes : 10
204+ timeout-minutes : 180
210205 strategy :
211206 fail-fast : false
212207 matrix :
@@ -228,8 +223,10 @@ 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
@@ -241,7 +238,15 @@ jobs:
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
0 commit comments