forked from equinor/tagreader-python
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (63 loc) · 2.16 KB
/
build.yml
File metadata and controls
67 lines (63 loc) · 2.16 KB
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
# This is a simplified test workflow that does not include tests that require a connection to server.
# If tests are successful and the push is a tag, then run a test-deploy to test.pypi.org.
name: Test
on: [push]
jobs:
test:
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install dependencies Windows
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install dependencies Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libkrb5-dev
python -m pip install --upgrade pip
pip install -r linux-requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-xdist
# Ignore extratests/tests which doesn't exist here
pytest tests
testdeploy-if-tagged:
needs: test
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*