Skip to content

Commit

Permalink
Merge pull request #118 from sdpython/ref
Browse files Browse the repository at this point in the history
Refactoring, ruff, black, cmake
  • Loading branch information
sdpython authored Oct 1, 2023
2 parents 4b610ba + ee563d3 commit 17859ed
Show file tree
Hide file tree
Showing 268 changed files with 13,558 additions and 20,982 deletions.
100 changes: 0 additions & 100 deletions .circleci/config.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/black-ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Black + Ruff Format Checker
on: [push, pull_request]
jobs:
black-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
with:
options: "--diff --check"
src: "."
ruff-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
47 changes: 47 additions & 0 deletions .github/workflows/check-urls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check URLs

on:
pull_request:
branches: [main]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * 0'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: urls-checker-code
uses: urlstechie/urlchecker-action@master
with:
subfolder: mlinsights
file_types: .md,.py,.rst,.ipynb
print_all: false
timeout: 2
retry_count# : 2
exclude_urls: https://github.com/microsoft/onnxruntime/blob/
exclude_patterns: https://github.com/microsoft/onnxruntime/blob/
# force_pass : true

- name: urls-checker-docs
uses: urlstechie/urlchecker-action@master
with:
subfolder: _doc
file_types: .md,.py,.rst,.ipynb
print_all: false
timeout: 2
retry_count# : 2
exclude_urls: 64,14: https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-$,https://developer.download.nvidia.com/compute/cuda/$
exclude_patterns: https://www.data.gouv.fr/fr/datasets/r/e3d83ab3-dc52-4c99-abaf-8a38050cc68c,https://dev.azure.com/
# force_pass : true
10 changes: 10 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Clang Format Checker
on: [push]
jobs:
clang-format-checking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: RafikFarhad/clang-format-github-action@v3
with:
sources: "src/**/*.h,src/**/*.c,test/**/*.c"
23 changes: 23 additions & 0 deletions .github/workflows/cmakelint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Cmake Format Checker

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Format CMake files
id: cmake-format
uses: PuneetMatharu/cmake-format-lint-action@v1.0.0
with:
args: --check

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: cmake-format-bot
commit_message: 'Automated commit of cmake-format changes.'
91 changes: 91 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Documentation and Code Coverage

on:
push:
pull_request:
types:
- closed
branches:
- main

jobs:
run:
name: Build documentation on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.11'

- uses: tlylt/install-graphviz@v1

- name: Install pandoc
run: sudo apt-get install -y pandoc

- name: Install requirements
run: python -m pip install -r requirements.txt

- name: Install requirements dev
run: python -m pip install -r requirements-dev.txt

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Build
run: python setup.py build_ext --inplace

- name: Generate coverage report
run: |
pip install pytest
pip install pytest-cov
export PYTHONPATH=.
pytest --cov=./mlinsights/ --cov-report=xml --durations=10 --ignore-glob=**LONG*.py --ignore-glob=**notebook*.py
export PYTHONPATH=
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Install
run: python setup.py install

- name: Copy license, changelogs
run: |
cp LICENSE* ./_doc
cp CHANGELOGS* ./_doc
- name: Documentation
run: python -m sphinx ./_doc ./dist/html -n -w doc.txt

- name: Summary
run: cat doc.txt

- name: Check for errors and warnings
run: |
if [[ $(grep ERROR doc.txt | grep -v 'validation.cuda') ]]; then
echo "Documentation produces errors."
grep ERROR doc.txt | grep -v 'validation.cuda'
exit 1
fi
if [[ $(grep WARNING doc.txt | grep -v 'validation.cuda') ]]; then
echo "Documentation produces warnings."
grep WARNING doc.txt | grep -v 'validation.cuda'
exit 1
fi
- uses: actions/upload-artifact@v3
with:
path: ./dist/html/**
28 changes: 28 additions & 0 deletions .github/workflows/rstcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: RST Check

on: [push, pull_request]

jobs:
build_wheels:
name: rstcheck ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

# Used to host cibuildwheel
- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install requirements
run: python -m pip install -r requirements.txt

- name: Install rstcheck
run: python -m pip install sphinx tomli rstcheck[toml,sphinx]

- name: rstcheck
run: rstcheck -r _doc mlinsights
40 changes: 40 additions & 0 deletions .github/workflows/wheels-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Wheel Linux

on:
push:
branches:
- main
- 'releases/**'

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

# Used to host cibuildwheel
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: python version
run: python -V

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
#env:
# # CIBW_BUILD: "cp310* cp311*"
# CIBW_SKIP: cp36-* cp37-* cp38-* cp39-*

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Loading

0 comments on commit 17859ed

Please sign in to comment.