test #2953
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |