forked from benchopt/benchopt
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (157 loc) · 5.21 KB
/
test.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
create:
tags:
- '**'
schedule:
# Run every day at 8:42am UTC.
- cron: '42 8 * * *'
# Cancel in-progress workflows when pushing
# a new commit on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test_benchopt:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
version_python: "3.10"
conda_cmd: 'mamba'
coverage: 'true'
- os: ubuntu-latest
version_python: "3.11"
- os: macos-latest
version_python: "3.10"
- os: windows-latest
version_python: "3.12"
env:
CONDA_ENV: 'testcondaenv'
JUNIT_XML: 'test-data.xml'
VERSION_PYTHON: ${{ matrix.version_python }}
COVERAGE: ${{ matrix.coverage }}
BENCHOPT_CONDA_CMD: ${{ matrix.conda_cmd || (matrix.os == 'windows-latest' && 'call conda') || 'conda' }}
defaults:
run:
# Need to use this shell to get cond working properly.
# See https://github.com/marketplace/actions/setup-miniconda#important
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
steps:
- uses: actions/checkout@v3
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ${{ env.CONDA_ENV }}
python-version: ${{ matrix.version_python }}
# Use miniforge to only get conda-forge as default channel.
miniforge-version: latest
- run: conda info
- name: Install Julia
run:
${{ env.BENCHOPT_CONDA_CMD }} install -yq -c https://repo.prefix.dev/julia-forge julia[version">=1.10.0"]
- name: Install benchopt and its dependencies
run: |
${{ env.BENCHOPT_CONDA_CMD }} info
${{ env.BENCHOPT_CONDA_CMD }} install -yq pip
pip install -e .[test]
# TODO merge this with previous test if possible
#last command : Install mamba in base environment to make it accessible test env
- name: 'Install mamba in base environment'
if: matrix.os != 'windows-latest'
run: test $BENCHOPT_CONDA_CMD == "mamba" && conda install -n base mamba || echo "using conda"
- name: 'Run the tests on Ubuntu/OSX'
if: matrix.os != 'windows-latest'
run: continuous_integration/test_script.sh
- name: 'Run the tests on Windows'
if: matrix.os == 'windows-latest'
run: continuous_integration\test_script_windows.bat
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
with:
report_paths: ${{ env.JUNIT_XML }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage
if: ${{ matrix.coverage == 'true' }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: test_benchopt
fail_ci_if_error: true
verbose: true
test_no_conda:
name: Test without conda
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
version_python: "3.10"
- os: macos-latest
version_python: "3.10"
- os: windows-latest
version_python: "3.12"
env:
JUNIT_XML: "test-data.xml"
VERSION_PYTHON: ${{ matrix.version_python }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ env.VERSION_PYTHON }}
- name: Install benchopt and its dependencies
run: pip install -e .
- name: Run benchopt without conda
run: benchopt run benchopt/tests/dummy_benchmark -d Simulated[n_features=100,n_samples=100,rho=0] -o "^*[reg=0.1]" -s python-pgd -r 1 -n 10 --no-plot
test_benchopt_reqs:
name: Test benchopt requirements detection
runs-on: ubuntu-latest
strategy:
matrix:
include:
- version_python: "3.10"
version_pip: "21.3"
- version_python: "3.10"
version_pip: "22.2"
- version_python: "3.11"
version_pip: "latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.version_python }}
- name: Install specific version of pip
run: |
if [[ "${{ matrix.version_pip }}" != "latest" ]]
then
pip install pip==${{ matrix.version_pip }}
else
pip install -U pip
fi
- name: Test package installation detection
run: continuous_integration/test_req_detection.sh
report_test:
if: ${{ always() }}
needs: [test_benchopt, test_no_conda]
runs-on: ubuntu-latest
env:
TEST_BENCHOPT: ${{ needs.test_benchopt.result }}
TEST_NO_CONDA: ${{ needs.test_no_conda.result }}
steps:
- name: "Gather test results."
run: |
if [[ $TEST_BENCHOPT == 'success' && $TEST_NO_CONDA == 'success' ]]; then
exit 0;
else
exit 1;
fi
shell: bash