forked from pyxem/pyxem
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.51 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: build
on:
push:
pull_request:
branches: [main]
env:
MPLBACKEND: agg
jobs:
build-with-pip:
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: ubuntu-latest
python-version: 3.8
DEPENDENCIES: diffsims==0.6.0 hyperspy~=2.0.rc0 lmfit==0.9.12 matplotlib==3.7.5 orix==0.12.1 scikit-image==0.19.0 scikit-learn==1.0.0
LABEL: -oldest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Get the number of CPUs
id: cpus
run: |
import os, platform
num_cpus = os.cpu_count()
print(f"Number of CPU: {num_cpus}")
print(f"Architecture: {platform.machine()}")
output_file = os.environ["GITHUB_OUTPUT"]
with open(output_file, "a", encoding="utf-8") as output_stream:
output_stream.write(f"count={num_cpus}\n")
shell: python
- name: Install dependencies and package
shell: bash
run: |
pip install -U -e .'[tests]'
- name: Install oldest supported versions
if: contains(matrix.LABEL, 'oldest')
run: |
pip install ${{ matrix.DEPENDENCIES }}
- name: Display Python, pip and package versions
run: |
python -V
pip -V
pip list
- name: Run docstring tests
continue-on-error: true
run: |
pytest --doctest-modules --doctest-continue-on-failure --ignore-glob=pyxem/tests pyxem
- name: Run tests
run: |
pytest -n 1 --cov=pyxem --runslow --pyargs pyxem --durations=50 --timeout=360
- name: Generate line coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
coverage report --show-missing
- name: Upload coverage to Coveralls
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
coveralls-finish:
needs: build-with-pip
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true