Skip to content

Add @martintb suggestions #745

Add @martintb suggestions

Add @martintb suggestions #745

Workflow file for this run

name: PyHyperScattering CI Testing
on:
push:
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os}}
strategy:
matrix:
python-version: ['3.10','3.11']
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest coverage
pip install pybind11 wheel
pip install -r requirements.txt
pip install -r requirements-bluesky.txt
pip install dask
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Fetch and unzip example data (Mac/Linux)
if: ${{ matrix.os != 'windows-latest' }}
run: |
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/Example.zip
unzip Example.zip
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/cyrsoxs-example.zip
unzip cyrsoxs-example.zip
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/mask-test-pack.zip
unzip mask-test-pack.zip
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/PSS300nm_C_ccd100.zip
unzip PSS300nm_C_ccd100.zip
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/smi_example.zip
unzip smi_example.zip
wget https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/CMS_giwaxs_series.zip
unzip CMS_giwaxs_series.zip
- name: Fetch and unzip example data (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/Example.zip
unzip Example.zip
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/cyrsoxs-example.zip
unzip cyrsoxs-example.zip
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/mask-test-pack.zip
unzip mask-test-pack.zip
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/PSS300nm_C_ccd100.zip
unzip PSS300nm_C_ccd100.zip
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/smi_example.zip
unzip smi_example.zip
C:\msys64\usr\bin\wget.exe https://github.com/usnistgov/PyHyperScattering/releases/download/0.0.0-example-data/CMS_giwaxs_series.zip
unzip CMS_giwaxs_series.zip
- name: Test with pytest
env:
TILED_API_KEY: ${{ secrets.TILED_API_KEY }}
run: |
#pytest -v
#temporarily disabling coverage for memory usage
coverage run -m pytest -v
- name: Report coverage
run: |
coverage report
coverage html
- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: coverage-${{ matrix.os}}-${{ matrix.python-version }}.html
path: htmlcov/index.html
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}