Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 1 | on: |
| 2 | push: |
| 3 | branches: |
David Brown | fe0bfcf | 2021-05-14 10:12:10 -0600 | [diff] [blame] | 4 | - main |
Fabio Utzig | c1b2983 | 2021-01-13 11:13:15 -0300 | [diff] [blame] | 5 | - v*-branch |
Denis Mingulov | 1202604 | 2023-09-26 09:30:12 +0300 | [diff] [blame] | 6 | pull_request: |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 7 | |
Fabio Utzig | 0be390e | 2020-11-12 10:45:07 -0300 | [diff] [blame] | 8 | name: imgtool |
| 9 | |
Gustavo Henrique Nihei | e571855 | 2021-12-17 10:35:59 -0300 | [diff] [blame] | 10 | concurrency: |
| 11 | group: imgtool-${{ github.event.pull_request.number || github.ref }} |
| 12 | cancel-in-progress: true |
| 13 | |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 14 | jobs: |
Denis Mingulov | 1202604 | 2023-09-26 09:30:12 +0300 | [diff] [blame] | 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 |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 45 | environment: |
Denis Mingulov | 1202604 | 2023-09-26 09:30:12 +0300 | [diff] [blame] | 46 | if: ${{ github.event_name == 'push' }} |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 47 | runs-on: ubuntu-latest |
| 48 | steps: |
| 49 | - uses: actions/checkout@v2 |
| 50 | with: |
| 51 | fetch-depth: 0 |
Fabio Utzig | 7bf5179 | 2021-02-11 19:30:55 -0300 | [diff] [blame] | 52 | - name: Cache pip |
| 53 | uses: actions/cache@v1 |
| 54 | with: |
| 55 | path: ~/.cache/pip |
| 56 | key: ${{ runner.os }}-pip |
Fabio Utzig | 0be390e | 2020-11-12 10:45:07 -0300 | [diff] [blame] | 57 | - name: Install packages |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 58 | run: | |
| 59 | export PATH="$HOME/.local/bin:$PATH" |
| 60 | ./ci/imgtool_install.sh |
Fabio Utzig | 0be390e | 2020-11-12 10:45:07 -0300 | [diff] [blame] | 61 | - name: Publish |
Fabio Utzig | c06694e | 2020-11-10 10:36:42 -0300 | [diff] [blame] | 62 | env: |
| 63 | TWINE_TOKEN: ${{ secrets.TWINE_TOKEN }} |
| 64 | run: | |
| 65 | export PATH="$HOME/.local/bin:$PATH" |
| 66 | ./ci/imgtool_run.sh |