10
10
test :
11
11
name : ${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.env }}
12
12
runs-on : ${{ matrix.os }}
13
+ defaults :
14
+ run :
15
+ shell : bash -l {0}
13
16
strategy :
14
17
fail-fast : false
15
18
matrix :
@@ -36,41 +39,20 @@ jobs:
36
39
- name : Checkout repo
37
40
uses : actions/checkout@v3
38
41
39
- - name : Setup mambaforge
40
- uses : conda-incubator/setup-miniconda@v2
41
- with :
42
- miniforge-variant : Mambaforge
43
- miniforge-version : latest
44
- activate-environment : spherely-dev
45
- use-mamba : true
46
- python-version : ${{ matrix.python-version }}
47
- environment-file : ${{ matrix.env }}
48
-
49
42
- name : Get Date
50
43
id : get-date
51
- shell : bash -l {0}
52
44
# cache will last one day
53
45
run : echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
54
46
55
- - name : Cache environment
56
- uses : actions/cache@v2
47
+ - name : Setup micromamba
48
+ uses : mamba-org/provision-with-micromamba@v15
57
49
with :
58
- path : ${{ env.CONDA }}/envs
59
- key : ${{ runner.os }}-{{ matrix.python-version }}-conda-${{ hashFiles( matrix.env ) }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}
60
- env :
61
- # Increase this value to reset cache if ci/environment.yml has not changed
62
- CACHE_NUMBER : 0
63
- id : conda-cache
64
-
65
- - name : Update environment
66
- run : mamba env update -n spherely-dev -f ${{ matrix.env }}
67
- if : steps.conda-cache.outputs.cache-hit != 'true'
68
-
69
- - name : Conda info
70
- shell : bash -l {0}
71
- run : |
72
- conda info
73
- conda list
50
+ environment-file : ${{ matrix.env }}
51
+ environment-name : spherely-dev
52
+ cache-env : true
53
+ cache-env-key : " ${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles( matrix.env) }}"
54
+ extra-specs : |
55
+ python=${{ matrix.python-version }}
74
56
75
57
- name : Fetch s2geography
76
58
uses : actions/checkout@v3
80
62
path : deps/s2geography
81
63
fetch-depth : 0
82
64
if : |
83
- matrix.dev == true &&
84
- steps.conda-cache.outputs.cache-hit != 'true'
65
+ matrix.dev == true
85
66
86
67
- name : Configure, build & install s2geography (unix)
87
- shell : bash -l {0}
88
68
run : |
89
69
cd deps/s2geography
90
70
cmake -S . -B build \
96
76
cmake --install build
97
77
if : |
98
78
matrix.dev == true &&
99
- (steps.conda-cache.outputs.cache-hit != 'true' &&
100
- (runner.os == 'Linux' || runner.os == 'macOS'))
79
+ (runner.os == 'Linux' || runner.os == 'macOS')
101
80
102
81
- name : Configure, build & install s2geography (win)
103
- shell : bash -l {0}
104
82
run : |
105
83
cd deps/s2geography
106
84
cmake -S . -B build \
@@ -111,15 +89,27 @@ jobs:
111
89
cmake --build build --config Release
112
90
cmake --install build
113
91
if : |
114
- matrix.dev == true &&
115
- (steps.conda-cache.outputs.cache-hit != 'true' &&
116
- runner.os == 'Windows')
92
+ matrix.dev == true && runner.os == 'Windows'
117
93
118
94
- name : Build and install spherely
119
- shell : bash -l {0}
120
- run : python -m pip install . -v --no-build-isolation
95
+ run : |
96
+ python -m pip install . -v --no-build-isolation --config-settings cmake.define.SPHERELY_CODE_COVERAGE=ON --config-settings build-dir=_skbuild
121
97
122
98
- name : Run tests
123
- shell : bash -l {0}
124
99
run : |
125
100
pytest . -vv
101
+
102
+ - name : Generate coverage report
103
+ run : |
104
+ python -m pip install gcovr
105
+ gcovr --exclude-unreachable-branches --print-summary -x -o coverage.xml
106
+ if : |
107
+ runner.os == 'Linux' && matrix.python-version == '3.11' && matrix.dev == false
108
+
109
+ - name : Upload coverage report
110
+ uses : codecov/codecov-action@v3
111
+ with :
112
+ files : ./coverage.xml
113
+ verbose : true
114
+ if : |
115
+ runner.os == 'Linux' && matrix.python-version == '3.11' && matrix.dev == false
0 commit comments