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 <denis@mingulov.com>
This commit is contained in:
Denis Mingulov 2023-09-26 09:30:12 +03:00 committed by Dávid Vincze
parent 898a1ca64a
commit 12026047bd
1 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@ on:
branches: branches:
- main - main
- v*-branch - v*-branch
pull_request:
name: imgtool name: imgtool
@ -11,7 +12,38 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.x", "pypy3.9"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pipenv'
cache-dependency-path: |
scripts/setup.py
- name: Install dependencies
run: |
pip install --user pipenv
- name: Run tests
run: |
cd scripts
pipenv run pip install pytest -e .
pipenv run pytest --junitxml=../junit/pytest-results-${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: pytest-results-${{ matrix.python-version }}
path: |
junit/pytest-results-${{ matrix.python-version }}*.xml
if-no-files-found: ignore
environment: environment:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2