forked from optuna/optuna
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (65 loc) · 2.31 KB
/
coverage.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
name: Coverage
on:
push:
branches:
- master
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
coverage:
runs-on: ubuntu-latest
# Not intended for forks.
if: github.repository == 'optuna/optuna'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- 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 openmpi-bin libopenmpi-dev libopenblas-dev
- name: Install
run: |
python -m pip install --upgrade pip
# Install minimal dependencies and confirm that `import optuna` is successful.
pip install --progress-bar off .
python -c 'import optuna'
optuna --version
pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu
pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu
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 -m "not skip_coverage and not slow"
coverage combine
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml