-
Notifications
You must be signed in to change notification settings - Fork 2
138 lines (113 loc) · 3.57 KB
/
run_tests_win.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Run the tests
on: [pull_request]
env:
PREFIX_WINDOWS: C:\Miniconda3\envs\cocofest
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
shard: [1, 2]
name: Tests on ${{ matrix.os }}-shard ${{ matrix.shard }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Set prefix windows
run: |
echo "PREFIX=${{ env.PREFIX_WINDOWS }}" >> $GITHUB_ENV
if: matrix.os == 'windows-latest'
- name: Checkout code
uses: actions/checkout@v3
- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: cocofest
environment-file: environment.yml
- name: Print mamba info
run: |
mamba info
mamba list
- name: Install bioptim on Windows
run: |
pwd
cd external
./bioptim_install_windows.sh 4 ${{ env.PREFIX_WINDOWS }}
cd ..
- name: Install extra dependencies
run: mamba install pytest-cov black pytest pytest-cov codecov packaging -cconda-forge
- name: Run tests with code coverage
run: pytest -v --color=yes --cov-report term-missing --cov=cocofest --cov-report=xml:coverage.xml tests/shard${{ matrix.shard }}
- name: Archive coverage report
id: archive
uses: actions/upload-artifact@v3
with:
name: coverage${{ matrix.shard }}
path: |
coverage.xml
.coverage
merge-coverage:
needs: build
runs-on: windows-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Set prefix windows
run: |
echo "PREFIX=${{ env.PREFIX_WINDOWS }}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: cocofest
environment-file: environment.yml
- name: Print mamba info
run: |
mamba info
- name: Install bioptim on Windows
run: |
pwd
cd external
./bioptim_install_windows.sh 4 ${{ env.PREFIX_WINDOWS }}
cd ..
- name: Install extra dependencies
run: pip install coverage
- name: Download all workflow run artifacts
id: download
uses: actions/download-artifact@v3
- name: Rename coverage files
run: |
for shard in {1,2}; do
mv coverage${shard}/coverage.xml coverage${shard}.xml
mv coverage${shard}/.coverage* .coverage${shard}
done
- name: Show current dir content
run: pwd; ls -a -l
- name: Merge coverage reports
run: coverage combine .coverage1 .coverage2
- name: Show current dir content with new .coverage file
run: pwd; ls -a
- name: Generate XML report
run: |
coverage xml
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
#token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
#files: ./coverage1.xml, ./coverage2.xml, ./coverage3.xml, ./coverage4.xml
flags: unittests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}