Skip to content

Switching pip-install.yml to only upload to PyPi on ubuntu-22.04 #170

Switching pip-install.yml to only upload to PyPi on ubuntu-22.04

Switching pip-install.yml to only upload to PyPi on ubuntu-22.04 #170

Workflow file for this run

name: tests-linux
on:
pull_request:
branches: [main]
workflow_dispatch:
jobs:
tests:
name: '${{ matrix.os }}:python-${{ matrix.python-version }}'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: ubuntu-22.04
python-version: '3.6'
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
id: setup_python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install
id: install
if: steps.setup_python.outcome == 'success'
shell: bash -l {0}
run: |
sudo apt-get update
python -m pip install -U pip
python -m pip install -e .
pip install pytest pytest-cov
sudo apt install lcov
- name: Run tests
id: test
if: steps.install.outcome == 'success'
shell: bash -l {0}
run: |
make opt
pytest --tb=short --junitxml=junit/test-results.xml
- name: Check test output created
id: check_test_file
uses: andstor/file-existence-action@v3
with:
files: "${{ github.workspace }}/junit/test-results.xml"
fail: true
- name: Publish unit test results
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: junit/test-*.xml
- name: Generate coverage
id: coverage
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' && steps.test.outcome == 'success' && steps.check_test_file.outcome == 'success' }}
run: make coverage
- name: Upload to CodeCov
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./.coverage