-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (130 loc) · 3.76 KB
/
ci.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
name: ci
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update pip
run: python3 -m pip install --no-cache --upgrade pip setuptools wheel
- name: Install dependencies
run: pip3 install .[format]
- name: Check PEP8 with black
run: black . --check
build:
needs: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update pip
run: python3 -m pip install --no-cache --upgrade pip pipx
- name: Build package
run: pipx run build --wheel
- uses: actions/upload-artifact@master
with:
name: package
path: ./dist
run_examples:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update pip
run: python3 -m pip install --no-cache --upgrade pip pipx
- uses: actions/checkout@v3
- uses: actions/download-artifact@master
with:
name: package
path: ./dist
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Install package
run: python3 -m pip install dist/*.whl
- name: Run ReductStore
run: docker run -p 8383:8383 -d reduct/store:main
- name: Run examples
run: find examples/ -name *.py | xargs python3
test:
needs: build
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
reductstore_version: ["latest", "main"]
token: ["", "ACCESS_TOKEN"]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@master
with:
name: package
path: ./dist
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Install package
run: python3 -m pip install dist/*
- name: Install dependencies
run: pip3 install .[test]
- name: Run ReductStore
run: docker run -p 8383:8383 -v ${PWD}/data:/data --env RS_API_TOKEN=${{matrix.token}} --env RS_LOG_LEVEL=DEBUG -d reduct/store:main
- name: Run Tests
run: PYTHONPATH=. RS_API_TOKEN=${{matrix.token}} pytest tests
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz
pylint:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@master
with:
name: package
path: ./dist
- name: Upgrade pip
run: pip install -U pip
- name: Install package
run: python3 -m pip install dist/*
- name: Install dependencies
run: pip3 install .[test,lint]
- name: Lint main
run: pylint ./reduct
- name: Lint tests
run: pylint ./tests
py-pip-upload:
name: Upload if release
needs: [ pylint, test, run_examples ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
steps:
- uses: actions/setup-python@v2
- uses: actions/download-artifact@v2
with:
name: package
path: ./dist
- uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}