forked from python-semantic-release/python-semantic-release
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (95 loc) · 2.88 KB
/
main.yml
File metadata and controls
113 lines (95 loc) · 2.88 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
111
112
113
name: Test & Release
on:
push:
branches:
- master
jobs:
test:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install .[test]
python -m pip install pytest-github-actions-annotate-failures
- name: pytest
run: python -m pytest -v tests
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install mypy & stubs packages
run: python -m pip install .[mypy]
- name: mypy
run: python -m mypy --ignore-missing-imports semantic_release
beautify:
name: Beautify
runs-on: ubuntu-latest
concurrency: push
needs: [test, mypy]
outputs:
new_sha: ${{ steps.sha.outputs.SHA }}
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Black
run: python -m pip install black
- name: Beautify with Black
run: python -m black .
- name: Install isort
run: python -m pip install "isort >=4,<5"
- name: Sort imports
run: python -m isort -y -rc .
- name: Commit and push changes
uses: github-actions-x/commit@v2.5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'style: beautify ${{ github.sha }}'
name: github-actions
email: action@github.com
- name: Get new SHA
id: sha
run: |
new_sha=$(git rev-parse HEAD)
echo "::set-output name=SHA::$new_sha"
release:
name: Semantic Release
runs-on: ubuntu-latest
concurrency: push
needs: [test, mypy, beautify]
if: github.repository == 'relekang/python-semantic-release'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ needs.beautify.outputs.new_sha }}
- name: Fetch master
run: git fetch --prune origin +refs/heads/master:refs/remotes/origin/master
- name: Python Semantic Release
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: ${{ secrets.PYPI_USERNAME }}
repository_password: ${{ secrets.PYPI_PASSWORD }}