forked from xorbitsai/xorbits
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (125 loc) · 4.07 KB
/
python.yaml
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
name: Python CI
on:
push:
branches:
- '*'
pull_request:
types: ['opened', 'reopened', 'synchronize']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: "python/xorbits"
args: "--config python/setup.cfg"
- name: black
uses: psf/black@stable
with:
src: "python/xorbits"
options: "--check --verbose --exclude xorbits/_mars/"
- uses: isort/isort-action@master
with:
sortPaths: "python/xorbits"
configuration: "--check-only --profile black --diff --skip-glob xorbits/_mars/"
- name: mypy
run: pip install mypy && cd python && mypy xorbits
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
run: cd python/xorbits/web/ui && npm ci
- name: ESLint Check
run: cd python/xorbits/web/ui && npx eslint .
- name: Prettier Check
run: cd python/xorbits/web/ui && ./node_modules/.bin/prettier --check .
build_test_job:
runs-on: ${{ matrix.os }}
needs: lint
env:
CONDA_ENV: xorbits-test
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
exclude:
- { os: macos-latest, python-version: 3.8}
- { os: macos-latest, python-version: 3.9}
- { os: windows-latest, python-version: 3.8}
- { os: windows-latest, python-version: 3.9}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}
use-only-tar-bz2: true
- name: Get Date
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Get conda prefix
id: get-conda-prefix
run: echo "::set-output name=conda_prefix::$(conda info --base)"
- name: Cache conda env
id: conda
uses: actions/cache@v2
env:
# Increase this value to reset cache if CI/conda-environment.yml has not changed
CACHE_NUMBER: 1
with:
path: |
${{ steps.get-conda-prefix.outputs.conda_prefix }}/envs/${{ env.CONDA_ENV }}
key:
# using date to refresh the cache every 24 hours
${{ runner.os }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
hashFiles('CI/conda-environment.yml') }}-${{ steps.get-date.outputs.today }}
- name: Install dependencies
# Only need to run install when deps have been changed
if: steps.conda.outputs.cache-hit != 'true'
run: |
conda env update -f CI/conda-environment.yml
- name: Install xorbits
run: |
pip install -e ".[dev,extra]"
working-directory: ./python
- name: Test with pytest
run: |
pytest --ignore xorbits/_mars/ --log-level=DEBUG --timeout=1500 \
-W ignore::PendingDeprecationWarning \
--cov-config=setup.cfg --cov-report=xml --cov=xorbits xorbits
working-directory: ./python
- name: Report coverage data
uses: codecov/codecov-action@v3
with:
working-directory: ./python
flags: unittests