-
Notifications
You must be signed in to change notification settings - Fork 284
175 lines (163 loc) · 6.56 KB
/
unittest.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
# 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 specified branches
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
unittest:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
config: [pyspark-2.4, tf-1.15, pyarrow-3.0, pyarrow-4.0, latest]
include:
- config: pyspark-2.4
PYARROW_VERSION: "2.0.0"
NUMPY_VERSION: "1.19.1"
TF_VERSION: "1.15.5"
PYSPARK_VERSION: "2.4.4"
ARROW_PRE_0_15_IPC_FORMAT: 1
PY: "3.7"
- config: tf-1.15
PYARROW_VERSION: "2.0.0"
NUMPY_VERSION: "1.19.1"
TF_VERSION: "1.15.5"
PYSPARK_VERSION: "3.0.0"
ARROW_PRE_0_15_IPC_FORMAT: 0
PY: "3.7"
- config: pyarrow-3.0
PYARROW_VERSION: "3.0.0"
NUMPY_VERSION: "1.19.1"
TF_VERSION: "2.5.0"
PYSPARK_VERSION: "3.0.0"
ARROW_PRE_0_15_IPC_FORMAT: 0
PY: "3.7"
- config: pyarrow-4.0
PYARROW_VERSION: "4.0.0"
NUMPY_VERSION: "1.19.1"
TF_VERSION: "2.5.0"
PYSPARK_VERSION: "3.0.0"
ARROW_PRE_0_15_IPC_FORMAT: 0
PY: "3.7"
- config: latest
PYARROW_VERSION: "6.0.1"
NUMPY_VERSION: "1.21.5"
TF_VERSION: "2.8.0"
PYSPARK_VERSION: "3.0.0"
ARROW_PRE_0_15_IPC_FORMAT: "0"
PY: "3.9"
# 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@v2
# Prepare
- name: prepare
run: |
export CI_IMAGE=selitvin/petastorm_ci_auto:ci-image-06-29-2021
docker pull $CI_IMAGE
docker images
pip install -U codecov
docker run -v `pwd`:/petastorm --name petastorm_ci $CI_IMAGE /bin/sh -c "sleep 3600" &
# Run unit tests
- name: build and run unit tests
run: |
sleep 30
export PYARROW_VERSION=${{matrix.PYARROW_VERSION}}
export NUMPY_VERSION=${{matrix.NUMPY_VERSION}}
export TF_VERSION=${{matrix.TF_VERSION}}
export PY=${{matrix.PY}}
export PYSPARK_VERSION=${{matrix.PYSPARK_VERSION}}
export ARROW_PRE_0_15_IPC_FORMAT=${{matrix.ARROW_PRE_0_15_IPC_FORMAT}}
export RUN="docker exec -e ARROW_PRE_0_15_IPC_FORMAT=$ARROW_PRE_0_15_IPC_FORMAT petastorm_ci bash /run_in_venv.sh ${PY}"
export PYTEST="pytest --timeout=360 -v --color=yes --cov=./ --cov-report xml:coverage.xml"
$RUN pip install -U pip setuptools
$RUN pip install -e /petastorm/[test,tf,torch,docs,opencv]
$RUN pip install --upgrade numpy==$NUMPY_VERSION
$RUN pip install -U pyarrow==${PYARROW_VERSION} tensorflow==${TF_VERSION} pyspark==${PYSPARK_VERSION}
$RUN pip list
$RUN mypy petastorm
$RUN flake8 . --count --show-source --statistics
$RUN flake8 . --count --exit-zero --max-complexity=20 --statistics
$RUN pylint --rcfile=.pylintrc petastorm examples -f parseable -r n
$RUN ulimit -c unlimited -S
$RUN bash -c "cd /petastorm/docs/autodoc && pwd && make html"
$RUN $PYTEST -m "forked" --forked -Y \
--ignore=examples/mnist/tests/test_pytorch_mnist.py \
--ignore=petastorm/tests/test_pytorch_utils.py \
--ignore=petastorm/tests/test_pytorch_dataloader.py \
--ignore=petastorm/tests/test_tf_autograph.py \
petastorm examples
$RUN $PYTEST -m "not forked" -Y --cov-append \
--ignore=examples/mnist/tests/test_pytorch_mnist.py \
--ignore=petastorm/tests/test_pytorch_utils.py \
--ignore=petastorm/tests/test_pytorch_dataloader.py \
--ignore=petastorm/tests/test_tf_autograph.py \
petastorm examples
$RUN $PYTEST --cov-append \
examples/mnist/tests/test_pytorch_mnist.py \
petastorm/tests/test_pytorch_dataloader.py \
petastorm/tests/test_pytorch_utils.py
$RUN $PYTEST -Y --cov-append petastorm/tests/test_tf_autograph.py
- name: codecov
run: codecov --required
draft_release:
needs: unittest
# Only come with a tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create release file
run: |
export VERSION_NUMBER=$(echo "${{ github.ref }}" | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p' | sed -e 's/\.//g')
echo "Version link appendix: ${VERSION_NUMBER}"
echo "https://github.com/uber/petastorm/blob/master/docs/release-notes.rst#release-${VERSION_NUMBER}" > /tmp/release.md
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: /tmp/release.md
draft: false
prerelease: ${{ contains(github.ref, 'rc') }} # having "rc" in version number means prerelease
deploy:
needs: draft_release
# Only come with a tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# The type of runner that the job will run on
runs-on: ubuntu-latest
# 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@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Before Deploy
run: |
pip install wheel
python setup.py bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}