From 12026047bd116e0ed7e8bfe02e520642edba153f Mon Sep 17 00:00:00 2001 From: Denis Mingulov Date: Tue, 26 Sep 2023 09:30:12 +0300 Subject: [PATCH] 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 --- .github/workflows/imgtool.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/imgtool.yaml b/.github/workflows/imgtool.yaml index ce9d5529..03b191e1 100644 --- a/.github/workflows/imgtool.yaml +++ b/.github/workflows/imgtool.yaml @@ -3,6 +3,7 @@ on: branches: - main - v*-branch + pull_request: name: imgtool @@ -11,7 +12,38 @@ concurrency: cancel-in-progress: true 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: + if: ${{ github.event_name == 'push' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2