Skip to content

Merge branch 'stable' into 0.10.x #206

Merge branch 'stable' into 0.10.x

Merge branch 'stable' into 0.10.x #206

name: pytest
on: push
jobs:
run_pytest:
name: run-tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest"]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: tests/test-env.yml
extra-specs: |
python=${{ matrix.python-version }}
channels: phygbu, conda-forge
channel-priority: flexible
- name: Conda info
run: ${MAMBA_EXE} info
- name: Conda list
run: ${MAMBA_EXE} list
- name: install package
run: ${MAMBA_ROOT_PREFIX}/envs/test-environment/bin/pip install --no-deps .
- name: Install headless server
run: |
sudo apt-get install xvfb
sudo apt-get install qtbase5-dev
- name: Test with xvfb
run: xvfb-run --auto-servernum ${MAMBA_ROOT_PREFIX}/envs/test-environment/bin/pytest --cov-report=xml:cov.xml --cov=Stoner --junitxml pytest.xml
env:
TZ: Europe/London
LC_CTYPE: en_GB.UTF-8
GH_ACTION: True
- name: Cleanup X11 server
uses: bcomnes/cleanup-xvfb@v1
- name: Run Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: python-${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results (Python ${{ matrix.python-version }})
path: pytest.xml
- name: Post Coveraage result to Codacy
run: |
export CODACY_PROJECT_TOKEN=${{ secrets.CODACY_PROJECT_TOKEN }}
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cov.xml
publish-test-results:
name: "Publish Unit Tests Results"
needs: run_pytest
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
coverage-finish:
needs: run_pytest
runs-on: ubuntu-latest
steps:
- name: Finish colveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true