Skip to content

save & restore crystal (& diffractometer) orientation #244

save & restore crystal (& diffractometer) orientation

save & restore crystal (& diffractometer) orientation #244

Workflow file for this run

name: Unit Tests
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # allow manual triggering
defaults:
run:
shell: bash -l {0}
jobs:
lint:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install package
run: |
set -vxeuo pipefail
python -m pip install --upgrade pip
- name: Run ruff
uses: davidslusser/[email protected]
with:
python_version: "3.11"
tests:
name: Python ${{ matrix.python-version }}
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10" # not 3.10 which truncates to 3.1
- "3.11"
- "3.12"
max-parallel: 5
steps:
- uses: actions/checkout@v4
- name: Create Python ${{ matrix.python-version }} environment
uses: mamba-org/setup-micromamba@v2
with:
cache-environment: true
cache-environment-key: env-key-${{ matrix.python-version }}
condarc: |
channel-priority: flexible
environment-file: environment.yml
environment-name: anaconda-test-env-py-${{ matrix.python-version }}
create-args: >-
pytest
python=${{ matrix.python-version }}
pyyaml
ruamel_yaml
yaml
setuptools-scm
- name: Install code coverage requirements by pip
run: |
# https://github.com/pradyunsg/furo/discussions/308#discussioncomment-3064061
pip install coverage coveralls
- name: Install source code
run: pip install -e . --no-deps
- name: Diagnostic
run: |
micromamba info
micromamba list
conda config --show-sources
conda config --show
micromamba env list
printenv | sort
- name: Run tests with pytest & coverage
shell: bash -l {0}
run: |
coverage run --concurrency=thread --parallel-mode -m pytest -vvv .
coverage combine
coverage report --precision 3 -m
- name: Upload to coveralls
# https://github.com/TheKevJames/coveralls-python
shell: bash -l {0}
run: |
micromamba list cover
micromamba list git
which coveralls
coveralls debug
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true
# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
coveralls:
name: Report unit test coverage to coveralls
needs: tests
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Gather coverage and report to Coveralls
run: |
set -vxeuo pipefail
apt-get install git
python3 -m pip3 install \
--no-cache-dir \
--root-user-action ignore \
--upgrade pip coveralls
# debug mode: output prepared json and reported files list to stdout
# https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html
#
echo "Finally!"
coveralls debug
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}