Skip to content

Merge pull request #1165 from mmerlo/Fix_logger #3

Merge pull request #1165 from mmerlo/Fix_logger

Merge pull request #1165 from mmerlo/Fix_logger #3

Workflow file for this run

name: PyMeasure CI
on:
push:
branches:
- master
- develop
pull_request:
jobs:
docs_lint:
name: Docs and Linting
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pymeasure requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: .github/pymeasure.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python and Mamba version
run: |
python --version
micromamba info
- name: Set up flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Lint with flake8
run: |
# Be sure to check for Python syntax errors or undefined names
flake8 . --count --extend-select=E9,F63,F7,F82 --show-source --statistics
- uses: ammaraskar/sphinx-problem-matcher@master
- name: Generate docs
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make html SPHINXOPTS="-W --keep-going"
- name: Run doctests
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make doctest SPHINXOPTS="-W --keep-going"
test_coverage:
name: Code Coverage on codecov
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pymeasure requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: .github/pymeasure.yml
create-args: python=${{ matrix.python-version }}
cache-environment-key: py${{ matrix.python-version }}-${{ matrix.os }}-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pymeasure
run: pip install -e .[tests] # editable for covtest
- name: Pymeasure version
run: python -c "import pymeasure;print(pymeasure.__version__)"
- name: Test for Coverage
# xvfb for graphical interface
run: |
echo "::add-matcher::.github/pytest.json"
xvfb-run -a pytest --cov=pymeasure --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.xml,!./cache
flags: unittests
name: codecov-umbrella
verbose: true
test:
name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pymeasure requirements
uses: mamba-org/setup-micromamba@v1
with:
# ternary operator: if python-version == 3.12 use pymeasure_python312.yml else use pymeasure.yml
environment-file: ${{ matrix.python-version == '3.12' && '.github/pymeasure_python312.yml' || '.github/pymeasure.yml'}}
create-args: python=${{ matrix.python-version }}
cache-environment-key: py${{ matrix.python-version }}-${{ matrix.os }}-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pymeasure
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install .[tests]
- name: Pymeasure version
run: python -c "import pymeasure;print(pymeasure.__version__)"
- name: Run pytest with xvfb
if: runner.os == 'Linux'
run: |
echo "::add-matcher::.github/pytest.json"
xvfb-run -a pytest
- name: Run pytest
if: runner.os != 'Linux'
run: |
echo "::add-matcher::.github/pytest.json"
pytest
test_numpy2:
name: Python 3.11, ubuntu-latest, numpy>=2
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pymeasure requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: .github/pymeasure_numpy2.yml
create-args: python=3.11
cache-environment-key: py3.11-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pymeasure
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install .[tests]
- name: Pymeasure version
run: python -c "import pymeasure;print(pymeasure.__version__)"
- name: Run pytest with xvfb
run: |
echo "::add-matcher::.github/pytest.json"
xvfb-run -a pytest