| 1 |
name: Continuous Integration |
| 2 |
on: |
| 3 |
schedule: |
| 4 |
- cron: '0 0 * * 2' |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- main |
| 8 |
pull_request: |
| 9 |
branches: |
| 10 |
- main |
| 11 |
paths: |
| 12 |
- .github/workflows/ci.yml |
| 13 |
- "benchmarks/**" |
| 14 |
- "kiwi/**" |
| 15 |
- "py/**" |
| 16 |
- "tests/**" |
| 17 |
- setup.py |
| 18 |
- pyproject.toml |
| 19 |
- CMakeLists.txt |
| 20 |
|
| 21 |
jobs: |
| 22 |
lint: |
| 23 |
name: Lint |
| 24 |
runs-on: ubuntu-latest |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
python-version: ['3.12'] |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v7 |
| 30 |
- name: Get history and tags for SCM versioning to work |
| 31 |
run: | |
| 32 |
git fetch --prune --unshallow |
| 33 |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 34 |
- name: Set up Python ${{ matrix.python-version }} |
| 35 |
uses: actions/setup-python@v7 |
| 36 |
with: |
| 37 |
python-version: ${{ matrix.python-version }} |
| 38 |
- name: Install dependencies |
| 39 |
run: | |
| 40 |
python -m pip install --upgrade pip |
| 41 |
pip install -r lint_requirements.txt |
| 42 |
pip install -e . |
| 43 |
- name: Formatting |
| 44 |
if: always() |
| 45 |
run: | |
| 46 |
ruff format py --check |
| 47 |
- name: Linting |
| 48 |
if: always() |
| 49 |
run: | |
| 50 |
ruff check py |
| 51 |
- name: Typing |
| 52 |
if: always() |
| 53 |
# We test twice to ensure the type annotations are properly installed |
| 54 |
run: | |
| 55 |
mypy py |
| 56 |
cd py/tests |
| 57 |
mypy . |
| 58 |
benchmark: |
| 59 |
name: C++ Benchmark |
| 60 |
runs-on: ${{ matrix.os }} |
| 61 |
strategy: |
| 62 |
matrix: |
| 63 |
os: [ubuntu-latest] |
| 64 |
steps: |
| 65 |
- uses: actions/checkout@v7 |
| 66 |
- name: Install dependencies |
| 67 |
run: | |
| 68 |
sudo apt-get update |
| 69 |
sudo apt-get install -y cmake ninja-build g++-11 |
| 70 |
- name: Configure CMake |
| 71 |
env: |
| 72 |
CXX: g++-11 |
| 73 |
run: | |
| 74 |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 75 |
- name: Build benchmark |
| 76 |
run: | |
| 77 |
cmake --build build --target kiwi_benchmark |
| 78 |
- name: Run benchmark |
| 79 |
run: | |
| 80 |
./build/benchmarks/kiwi_benchmark |
| 81 |
cpp-tests: |
| 82 |
name: C++ Tests |
| 83 |
runs-on: ${{ matrix.os }} |
| 84 |
strategy: |
| 85 |
matrix: |
| 86 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 87 |
build_type: [Release] |
| 88 |
steps: |
| 89 |
- uses: actions/checkout@v7 |
| 90 |
- name: Install dependencies (Linux) |
| 91 |
if: matrix.os == 'ubuntu-latest' |
| 92 |
run: | |
| 93 |
sudo apt-get update |
| 94 |
sudo apt-get install -y cmake ninja-build |
| 95 |
- name: Install dependencies (macOS) |
| 96 |
if: matrix.os == 'macos-latest' |
| 97 |
run: | |
| 98 |
brew install cmake ninja |
| 99 |
- name: Configure CMake |
| 100 |
run: | |
| 101 |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 102 |
- name: Build |
| 103 |
run: | |
| 104 |
cmake --build build --config ${{ matrix.build_type }} |
| 105 |
- name: Run tests |
| 106 |
run: | |
| 107 |
cd build/tests/ |
| 108 |
ctest --output-on-failure -C ${{ matrix.build_type }} |
| 109 |
tests: |
| 110 |
name: Unit tests |
| 111 |
runs-on: ${{ matrix.os }} |
| 112 |
strategy: |
| 113 |
matrix: |
| 114 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 115 |
python-version: ['3.10', '3.11', '3.12', '3.13', '3.13t', '3.14', '3.14t', '3.15-dev', '3.15t-dev', 'pypy-3.10', 'pypy-3.11', 'graalpy-25.0'] |
| 116 |
steps: |
| 117 |
- uses: actions/checkout@v7 |
| 118 |
- name: Get history and tags for SCM versioning to work |
| 119 |
run: | |
| 120 |
git fetch --prune --unshallow |
| 121 |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 122 |
- name: Set up Python ${{ matrix.python-version }} |
| 123 |
uses: actions/setup-python@v7 |
| 124 |
with: |
| 125 |
python-version: ${{ matrix.python-version }} |
| 126 |
- name: Install dependencies |
| 127 |
run: | |
| 128 |
python -m pip install --upgrade pip |
| 129 |
- name: Install project |
| 130 |
env: |
| 131 |
CPPFLAGS: --coverage |
| 132 |
run: | |
| 133 |
pip install . |
| 134 |
- name: Test with pytest |
| 135 |
run: | |
| 136 |
pip install pytest |
| 137 |
python -X dev -m pytest py -W error |
| 138 |
- name: Generate C++ coverage reports |
| 139 |
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest') |
| 140 |
run: | |
| 141 |
bash -c "find . -type f -name '*.gcno' -exec gcov -pb --all-blocks {} +" || true |
| 142 |
- name: Upload coverage to Codecov |
| 143 |
uses: codecov/codecov-action@v7 |
| 144 |
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest') |
| 145 |
with: |
| 146 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 147 |
flags: unittests |
| 148 |
name: codecov-umbrella |
| 149 |
fail_ci_if_error: true |