-
Notifications
You must be signed in to change notification settings - Fork 595
199 lines (188 loc) · 6.81 KB
/
main.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
types:
- opened
- reopened
- synchronize
- ready_for_review
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: 👀 List Changed Evidently Files
outputs:
evidently_any_modified: ${{ steps.changed-files.outputs.evidently_python_any_modified == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Get all python files that have changed
id: changed-files
uses: tj-actions/changed-files@v42
with:
files_yaml: |
evidently_python:
- src/evidently/**
- '!src/evidently/ui/ui/**'
- '!src/evidently/nbextension/**'
- example_test.py
- examples/**.ipynb
- requirements.dev.txt
- requirements.min.txt
- setup.py
- setup.cfg
- setupbase.py
- pylintrc
- tests/**
- name: Run step if evidently_python file(s) change
if: steps.changed-files.outputs.evidently_python_any_modified == 'true'
run: |
echo "One or more evidently_python file(s) has changed."
echo "List all the files that have changed: ${{ steps.changed-files.outputs.evidently_python_all_changed_and_modified_files }}"
linter:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: changed_files
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.evidently_any_modified == 'true' }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
architecture: "x64"
cache: "pip"
# Runs a single command using the runners shell
- name: Install dependencies
run: pip install -r requirements.min.txt && pip install -r requirements.dev.txt
# run black separately for source and tests folders (prevent generated examples folder checking)
# temporary specify line length and python version explicitly for black
# it cannot find the settings in setup.cfg
- name: Run Black
run: black --check --diff -l 120 -t py37 src
- name: Run Black for Tests
run: black --check --diff -l 120 -t py37 tests
# run isort separately for source and tests folders (prevent generated examples folder checking)
- name: Run iSort
run: isort --check src
- name: Run iSort for Tests
run: isort --check tests
# run flake8 separately for source and tests folders
- name: Run Flake8
run: flake8 src
- name: Run Flake8 for Tests
run: flake8 tests
- name: Run Mypy
run: mypy
test-minimal:
name: Test on minimal requirements
runs-on: ubuntu-latest
needs: changed_files
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.evidently_any_modified == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
architecture: "x64"
cache: "pip"
- name: Install package
run: pip install -e .[dev,spark,fsspec]
- name: Install minimal dependencies
run: pip install -r requirements.min.txt
- name: Run Tests
run: python -m pytest --durations=50
test:
# The type of runner that the job will run on
name: Test ${{ matrix.os }} with py${{ matrix.python }}
needs: linter
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python: "3.7"
- os: windows-latest
python: "3.12"
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: "x64"
cache: "pip"
- name: Install package
run: pip install -e .[dev,spark,fsspec]
- name: Run Tests
run: python -m pytest --durations=50
test-examples:
name: Test examples on ${{ matrix.os }} with py${{ matrix.python }}, min ${{ matrix.minimal }}
needs: test
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.7"]
minimal: [false]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: "x64"
cache: "pip"
- name: Install package
run: pip install -e .[dev,spark,fsspec]
- name: Install minimal reqs
if: matrix.minimal
run: pip install -r requirements.min.txt
- name: Prepare examples dependencies
run: pip install catboost sentence-transformers
- name: Export examples
run: jupyter nbconvert --to python examples/*/*.ipynb --output-dir example_scripts
- name: Download test data
run:
curl -k https://archive.ics.uci.edu/static/public/275/bike+sharing+dataset.zip -o Bike-Sharing-Dataset.zip &&
unzip Bike-Sharing-Dataset.zip -d Bike-Sharing-Dataset
- name: Run examples
run: python example_test.py
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: changed_files
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.evidently_any_modified == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
architecture: "x64"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.min.txt
- name: Install wheel
run: pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Archive built package
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: dist/