-
Notifications
You must be signed in to change notification settings - Fork 60
153 lines (137 loc) · 4.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
name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
create:
tags:
- '**'
schedule:
# Run every day at 8:42am UTC.
- cron: '42 8 * * *'
jobs:
test_benchopt:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
version_python: 3.8
- os: ubuntu-latest
version_python: 3.9
conda_cmd: 'mamba'
coverage: 'true'
- os: macos-latest
version_python: 3.9
env:
CONDA_ENV: 'testcondaenv'
JUNIT_XML: 'test-data.xml'
VERSION_PYTHON: ${{ matrix.version_python }}
COVERAGE: ${{ matrix.coverage }}
BENCHOPT_CONDA_CMD: ${{ matrix.conda_cmd || 'conda' }}
defaults:
run:
# Need to use this shell to get cond working properly.
# See https://github.com/marketplace/actions/setup-miniconda#important
shell: 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 benchopt and its dependencies
run: |
conda info
conda install -yq pip
conda install -yq "julia<=1.10.0"
pip install -e .[test]
# Install mamba in base environment to make it accessible test env
test $BENCHOPT_CONDA_CMD == "mamba" && conda install -n base mamba || echo "using conda"
- name: 'Run the tests'
run: continuous_integration/test_script.sh
- 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@v1
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.9
- os: macos-latest
version_python: 3.9
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.9"
version_pip: "21.3"
- version_python: "3.9"
version_pip: "22.2"
- version_python: "3.10"
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