-
Notifications
You must be signed in to change notification settings - Fork 17
123 lines (117 loc) · 3.86 KB
/
pytest_ubuntu.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Install scico requirements and run pytest
name: unit tests (ubuntu)
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
name: pytest split ${{ matrix.group }} (ubuntu)
defaults:
run:
shell: bash -l {0}
steps:
# Check-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v4
with:
submodules: recursive
# Set up conda environment
- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: test-env
python-version: "3.12"
# Configure conda environment cache
- name: Set up conda environment cache
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}-${{ env.CACHE_NUMBER }}
env:
CACHE_NUMBER: 0 # Increase this value to force cache reset
id: cache
# Display environment details
- name: Display environment details
run: |
conda info
printenv | sort
# Install required system package
- name: Install required system package
run: sudo apt-get install -y libopenblas-dev
# Install dependencies in conda environment
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
conda install -c conda-forge pytest pytest-cov
python -m pip install --upgrade pip
pip install pytest-split
pip install -r requirements.txt
pip install -r dev_requirements.txt
pip install bm4d>=4.2.2
pip install bm3d>=4.0.0
pip install "ray[tune]>=2.5.0"
pip install hyperopt
conda install -c conda-forge svmbir>=0.4.0
conda install -c conda-forge astra-toolbox
conda install -c conda-forge pyyaml
# Install package to be tested
- name: Install package to be tested
run: pip install -e .
# Run unit tests
- name: Run main unit tests
run: |
DURATIONS_FILE=$(mktemp)
bzcat data/pytest/durations_ubuntu.bz2 > $DURATIONS_FILE
pytest -x --cov --level=2 --durations-path=$DURATIONS_FILE --splits=5 --group=${{ matrix.group }} --pyargs scico
# Upload coverage data
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: coverage${{ matrix.group }}
path: ${{ github.workspace }}/.coverage
# Run doc tests
- name: Run doc tests
if: matrix.group == 1
run: |
pytest --ignore-glob="*test_*.py" --ignore=scico/linop/xray --doctest-modules scico
pytest --doctest-glob="*.rst" docs
coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install coverage
- name: Download all artifacts
# Downloads coverage1, coverage2, etc.
uses: actions/download-artifact@v4
- name: Run coverage
run: |
coverage combine coverage?/.coverage
coverage report
coverage xml
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
env_vars: OS,PYTHON
fail_ci_if_error: false
files: coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true