Skip to content

Commit 1202604

Browse files
mingulovdavidvincze
authored andcommitted
ci: add imgtool test to workflows
Add imgtool test call to workflows, use pytest and publish artifacts with test results. Also enable test run on 'pull_request', but limit the previous default imgtool_run.sh run ('environment' job) to run on 'push' event only (the same behaviour as before). Signed-off-by: Denis Mingulov <[email protected]>
1 parent 898a1ca commit 1202604

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/imgtool.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
branches:
44
- main
55
- v*-branch
6+
pull_request:
67

78
name: imgtool
89

@@ -11,7 +12,38 @@ concurrency:
1112
cancel-in-progress: true
1213

1314
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: ["3.x", "pypy3.9"]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
cache: 'pipenv'
27+
cache-dependency-path: |
28+
scripts/setup.py
29+
- name: Install dependencies
30+
run: |
31+
pip install --user pipenv
32+
- name: Run tests
33+
run: |
34+
cd scripts
35+
pipenv run pip install pytest -e .
36+
pipenv run pytest --junitxml=../junit/pytest-results-${{ matrix.python-version }}.xml
37+
- name: Upload test results
38+
uses: actions/upload-artifact@v3
39+
if: always()
40+
with:
41+
name: pytest-results-${{ matrix.python-version }}
42+
path: |
43+
junit/pytest-results-${{ matrix.python-version }}*.xml
44+
if-no-files-found: ignore
1445
environment:
46+
if: ${{ github.event_name == 'push' }}
1547
runs-on: ubuntu-latest
1648
steps:
1749
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)