forked from databricks/automl
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.95 KB
/
publish-to-pypi.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
# whenever you push a tagged commit to your Git repository remote on GitHub, this workflow will publish it to PyPI.
# Follow the guide: https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish AutoML runtime package to PyPI and TestPyPI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
python -m pip install build --user
if [ -f environment.txt ]; then pip install -r environment.txt; fi
if [ -f test-environment.txt ]; then pip install -r test-environment.txt; fi
working-directory: runtime
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E901,E999,F821,F822,F823,F401,F405 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-line-length=100 --statistics
working-directory: runtime
- name: Test with pytest
run: |
python -m pytest --cache-clear --cov=databricks tests/
working-directory: runtime
- name: Build a binary wheel and and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
working-directory: runtime
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: runtime/dist/
skip_existing: true