-
Notifications
You must be signed in to change notification settings - Fork 48
175 lines (174 loc) · 7.31 KB
/
ci.yml
File metadata and controls
175 lines (174 loc) · 7.31 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# A GitHub Actions workflow file to run on pull request and on main.
name: CI Tests
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
jobs:
# ----------------------------------------------------------------------------------------------
# Code Quality Checks and Linting
# ----------------------------------------------------------------------------------------------
check_code_quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
enable-cache: true
- name: Install pre-commit
run: |
uv sync --group lint
uv run pre-commit install
- name: Run code-quality checks
run: uv run pre-commit run --all-files --show-diff-on-failure
# ----------------------------------------------------------------------------------------------
# Install and Import Check
# ----------------------------------------------------------------------------------------------
install_and_import_shapiq:
name: Install and import check shapiq
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.12"
- os: macos-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Create uv virtual environment
run: uv venv
- name: Install shapiq package
run: uv run --no-sync uv pip install .
- name: Test import
run: uv run --no-sync python -c "import shapiq; print('shapiq imported successfully')"
# ----------------------------------------------------------------------------------------------
# Install and Import Check
# ----------------------------------------------------------------------------------------------
install_and_import_shapiq_games:
name: Install and import check shapiq-games
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
enable-cache: true
- name: Create uv virtual environment
run: uv venv
- name: Install shapiq package
run: uv run --no-sync uv pip install .
- name: Install dependencies
run: uv sync --no-dev --group all_ml
- name: Test import of shapiq_games
run: uv run --no-sync python -c "import shapiq_games; print('shapiq_games imported successfully')"
# ----------------------------------------------------------------------------------------------
# Unit Tests with Matrix
# ----------------------------------------------------------------------------------------------
test_shapiq:
name: Run Unit Tests
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.12"
- os: macos-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install test dependencies
run: uv sync
- name: Run unit tests
run: uv run pytest "tests/shapiq"
# ----------------------------------------------------------------------------------------------
# Unit Tests for shapiq-games
# ----------------------------------------------------------------------------------------------
test_shapiq_games:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest "tests/shapiq_games" -n logical
# ----------------------------------------------------------------------------------------------
# Test Documentation Build
# ----------------------------------------------------------------------------------------------
doc_build:
name: Test Documentation Build
runs-on: ubuntu-latest
needs:
- install_and_import_shapiq
- check_code_quality
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
enable-cache: true
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc
- name: Install dependencies
run: uv sync --no-dev --group docs
# TODO(mmshlk) Turn this step to fail on warnings in the future.
- name: Build documentation
run: uv run --no-sync sphinx-build -b html docs/source docs/build/html
# ----------------------------------------------------------------------------------------------
# Code Coverage
# ----------------------------------------------------------------------------------------------
run_coverage:
name: Run Test Coverage
runs-on: ubuntu-latest
needs:
- install_and_import_shapiq
- check_code_quality
steps:
- uses: actions/checkout@v5
- name: Set up Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
enable-cache: true
- name: Install test dependencies
run: uv sync
- name: Measure coverage
run: uv run pytest "tests/shapiq" --cov=shapiq --cov-report=xml -n logical
- name: Upload coverage to codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true