Skip to content

Opt out analytics in CI #15

Opt out analytics in CI

Opt out analytics in CI #15

Workflow file for this run

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/optunahub'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- 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: Install
run: |
python -m pip install --upgrade pip
# Install minimal dependencies and confirm that `import optunahub` is successful.
pip install --progress-bar off .
python -c 'import optunahub'
pip install --progress-bar off .[test]
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
OPTUNAHUB_NO_ANALYTICS: 1
run: |
coverage run --source=optunahub -m pytest tests
coverage combine
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
fail_ci_if_error: true