Skip to content

Commit 058f386

Browse files
authored
ci: run examples (#401)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 4a72f51 commit 058f386

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.github/workflows/poetry.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ jobs:
134134
architecture: 'x64'
135135

136136
- name: Validate Python Environment
137-
run: echo "import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))" | python
137+
run: import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))
138+
shell: python
138139

139140
- name: Install poetry
140141
# see https://github.com/marketplace/actions/setup-poetry
@@ -165,3 +166,34 @@ jobs:
165166
name: ${{ env.REPORTS_ARTIFACT }}
166167
path: ${{ env.REPORTS_DIR }}
167168
if-no-files-found: error
169+
170+
build-and-run-examples:
171+
name: Examples
172+
runs-on: ubuntu-latest
173+
timeout-minutes: 15
174+
strategy:
175+
fail-fast: false
176+
steps:
177+
- name: Checkout
178+
# see https://github.com/actions/checkout
179+
uses: actions/checkout@v3
180+
- name: Setup Python Environment
181+
# see https://github.com/actions/setup-python
182+
uses: actions/setup-python@v4
183+
with:
184+
python-version: '>=3.7 <=3.11' # supported version range
185+
- name: Validate Python Environment
186+
run: import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))
187+
shell: python
188+
- name: Install poetry
189+
# see https://github.com/marketplace/actions/setup-poetry
190+
uses: Gr1N/setup-poetry@v8
191+
with:
192+
poetry-version: ${{ env.POETRY_VERSION }}
193+
- name: Install project
194+
run: poetry install
195+
- name: run all examples
196+
run: >
197+
find examples -type f -name '*.py' -print0
198+
| xargs -0 -L1 -t
199+
poetry run python

examples/build_and_serialize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
# endregion build the BOM
4040

41-
4241
serializedJSON = JsonV1Dot4(bom).output_as_string()
4342
print(serializedJSON)
4443

0 commit comments

Comments
 (0)