-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (73 loc) · 2.68 KB
/
release.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
name: Test and Release
on:
push:
branches: [ master ]
jobs:
Quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Configure poetry & Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry install
- name: View poetry version
run: poetry --version
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Security Analysis with bandit
run: |
# stop pipeline if level 3 vulnerability found
poetry run bandit -r -lll ./nekton ./tests
- name: Submodules Setup
uses: actions/checkout@v2
with:
submodules: recursive
- name: Test with pytest
run: |
poetry run python -m pytest -v tests
Release:
needs: Quality
# https://github.saobby.my.eu.orgmunity/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'chore(release):')
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Submodules Setup
uses: actions/checkout@v2
with:
submodules: recursive
# This action uses Python Semantic Release v8
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: '-vv'
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}