-
Notifications
You must be signed in to change notification settings - Fork 35
110 lines (104 loc) · 3.17 KB
/
release.yml
File metadata and controls
110 lines (104 loc) · 3.17 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
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
name: Release Perception
on:
push:
branches:
- master
jobs:
formatting:
name: Check Code Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Formatting
run: |
python -m pip install --upgrade pip
pip install black flake8
- name: Check Formatting
run: |
flake8 --config=.flake8 .
black -l 79 --check .
tests:
name: Run Unit Tests
needs: formatting
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest, windows-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 Nose2
run: |
python -m pip install --upgrade pip
pip install nose2
- name: Install Perception
run: pip install .
- name: Run Nose Tests
run: nose2
pypi:
name: Release To PyPi
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v5.1
- name: Set up Python
if: contains(steps.changed-files.outputs.modified_files, 'perception/version.py')
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install publishing dependencies
if: contains(steps.changed-files.outputs.modified_files, 'perception/version.py')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if: contains(steps.changed-files.outputs.modified_files, 'perception/version.py')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
release:
name: Create GitHub Release
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v5.1
- name: Tag Version
if: contains(steps.changed-files.outputs.modified_files, 'perception/version.py')
id: set_tag
run: |
export VER=$(python -c "exec(open('perception/version.py','r').read());print(__version__)")
echo "::set-output name=tag_name::${VER}"
- name: Create Release
if: contains(steps.changed-files.outputs.modified_files, 'perception/version.py')
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.set_tag.outputs.tag_name }}
release_name: Release ${{ steps.set_tag.outputs.tag_name }}
draft: false
prerelease: false