Merge pull request #58 from not522/fix-default-branch #257
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: Coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
# Not intended for forks. | |
if: github.repository == 'optuna/optuna-integration' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: coverage | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} | |
- name: Setup environment | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libopenblas-dev | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install --progress-bar off .[test] | |
pip install --progress-bar off .[all] | |
# Install distributed to run importance_tests/test_init tests. | |
pip install distributed | |
echo 'import coverage; coverage.process_startup()' > sitecustomize.py | |
- name: Output installed packages | |
run: | | |
pip freeze --all | |
- name: Output dependency tree | |
run: | | |
pip install pipdeptree | |
pipdeptree | |
- name: Tests | |
env: | |
OMP_NUM_THREADS: 1 | |
PYTHONPATH: . # To invoke sitecutomize.py | |
COVERAGE_PROCESS_START: .coveragerc # https://coverage.readthedocs.io/en/6.4.1/subprocess.html | |
COVERAGE_COVERAGE: yes # https://github.com/nedbat/coveragepy/blob/65bf33fc03209ffb01bbbc0d900017614645ee7a/coverage/control.py#L255-L261 | |
run: | | |
coverage run --source=optuna -m pytest tests \ | |
--ignore tests/test_mxnet.py | |
coverage combine | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml |