Skip to content

Merge pull request #33 from stonerlab/copilot/modify-imagearray-as-de… #350

Merge pull request #33 from stonerlab/copilot/modify-imagearray-as-de…

Merge pull request #33 from stonerlab/copilot/modify-imagearray-as-de… #350

name: pytest
on: push
jobs:
run_pytest:
name: run-tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
checks: write
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12","3.13", "3.14"]
os: ["ubuntu-latest"]
steps:
- name: Check out repository code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install Mamba environment
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
with:
environment-file: tests/test-env.yml
environment-name: test-environment
create-args: >-
python=${{ matrix.python-version }}
--channel-priority flexible
init-shell: bash
cache-downloads: true
cache-environment: true
- name: Mamba information
run: |
micromamba info
micromamba list
- name: install package
run: pip install --no-deps .
- name: Install headless server
run: |
sudo apt-get update
sudo apt-get install xvfb
sudo apt-get install qtbase5-dev
- name: Test with xvfb
run: |
xvfb-run --auto-servernum pytest -n 2 --cov-report= --cov=Stoner --junitxml pytest.xml
coverage xml
env:
TZ: Europe/London
LC_CTYPE: en_GB.UTF-8
GH_ACTION: True
- name: Cleanup X11 server
uses: bcomnes/cleanup-xvfb@9e016c43bb8d73fe7d5933d2ef00fd770c1a7c50 # v1.0.9
- name: Coveralls Parallel
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
flag-name: run-${{ join(matrix.*, '-') }}
format: cobertura
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
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 coverage.xml
publish-test-results:
name: "Publish Unit Tests Results"
needs: run_pytest
runs-on: ubuntu-latest
if: always()
permissions:
checks: write
pull-requests: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
with:
files: artifacts/**/*.xml
coverage-finish:
needs: run_pytest
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
parallel-finished: true
carryforward: "run-1,run-2"