-
Notifications
You must be signed in to change notification settings - Fork 232
93 lines (78 loc) · 2.33 KB
/
tests.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
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
tests:
name: "py${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8]
os: [ubuntu-latest, macos-latest]
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 -U pip
python -m pip install ".[test]"
- name: Check the style
run: |
isort -c src/corner
isort -c tests
black --check src/corner
black --check tests
- name: Run the unit tests
run: python -m pytest -v tests
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
path: ./result_images
build:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"
- name: Build
run: |
python -m pip install -U pip pep517 twine setuptools_scm
python -m pep517.build .
- name: Test the sdist
run: |
python -m venv venv-sdist
venv-sdist/bin/python -m pip install dist/corner*.tar.gz
venv-sdist/bin/python -c "import corner;print(corner.__version__)"
- name: Test the wheel
run: |
python -m venv venv-wheel
venv-wheel/bin/python -m pip install dist/corner*.whl
venv-wheel/bin/python -c "import corner;print(corner.__version__)"
- uses: actions/upload-artifact@v2
with:
path: dist/*
upload_pypi:
needs: [tests, build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/