6
6
- cron : ' 3 2 1 * *' # M H d m w (monthly at 2:03)
7
7
jobs :
8
8
check :
9
+ if : github.event_name != 'pull_request' || github.head_ref != 'devel'
9
10
name : Check
10
11
runs-on : ubuntu-latest
11
12
steps :
12
13
- uses : actions/checkout@v2
14
+ with :
15
+ fetch-depth : 0
13
16
- uses : actions/setup-python@v2
14
17
with :
15
18
python-version : ' 3.x'
16
- - name : Install
19
+ - name : set PYSHA
20
+ run : echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
21
+ - uses : actions/cache@v1
22
+ with :
23
+ path : ~/.cache/pre-commit
24
+ key : pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
25
+ - name : Test
17
26
run : |
18
27
pip install -U tox
19
- pip install -U .
20
- - name : Test
21
- run : tox
28
+ tox
29
+ env :
30
+ TOXENV : ' setup.py,nodeps'
31
+ - name : Self install
32
+ run : pip install -U .[dev]
33
+ - name : Build
34
+ run : |
35
+ python setup.py sdist bdist_wheel
36
+ twine check dist/*
37
+ - uses : reviewdog/action-setup@v1
38
+ - if : github.event_name != 'schedule'
39
+ name : flake8
40
+ run : |
41
+ pre-commit run -a flake8 | reviewdog -f=pep8 -name=Format -tee -reporter=github-check -filter-mode nofilter
22
42
env :
23
- TOXENV : ' flake8,setup.py,nodeps'
43
+ REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44
+ - name : Lint
45
+ run : pre-commit run -a --show-diff-on-failure
24
46
test :
47
+ if : github.event_name != 'pull_request' || github.head_ref != 'devel'
25
48
strategy :
26
49
matrix :
27
- python : [2.7, 3.5, 3.6, 3.7, 3.8]
50
+ python : [2.7, 3.5, 3.6, 3.7, 3.8, 3.9 ]
28
51
name : Python ${{ matrix.python }}
29
52
runs-on : ubuntu-latest
30
53
steps :
31
54
- uses : actions/checkout@v2
55
+ with :
56
+ fetch-depth : 0
32
57
- uses : actions/setup-python@v2
33
58
with :
34
59
python-version : ${{ matrix.python }}
35
60
- name : Install
36
- run : |
37
- pip install -U tox setuptools_scm
61
+ run : pip install -U tox
38
62
- name : Test
39
63
run : tox -e py${PYVER/./}
40
64
env :
@@ -45,30 +69,32 @@ jobs:
45
69
with :
46
70
parallel : true
47
71
finish :
72
+ if : github.event_name != 'pull_request' || github.head_ref != 'devel'
48
73
name : Coverage
49
74
needs : test
50
75
runs-on : ubuntu-latest
51
76
steps :
52
77
- name : Coveralls Finished
53
- uses : exoplanet-dev /coveralls-python-action@develop # https://github.com/AndreMiras/coveralls-python-action/pull/5
78
+ uses : AndreMiras /coveralls-python-action@develop
54
79
with :
55
80
parallel-finished : true
56
81
deploy :
82
+ if : github.event_name != 'pull_request' || github.head_ref != 'devel'
57
83
name : Deploy
58
- needs : [check, test, finish ]
84
+ needs : [check, test]
59
85
runs-on : ubuntu-latest
60
86
steps :
61
87
- uses : actions/checkout@v2
88
+ with :
89
+ fetch-depth : 0
62
90
- uses : actions/setup-python@v2
63
91
with :
64
92
python-version : ' 3.x'
65
93
- name : Install
66
94
run : |
67
95
sudo apt-get install -yqq pandoc
68
- pip install setuptools_scm
69
- git fetch --unshallow --tags
70
96
pip install .[dev]
71
- make build .dockerignore snapcraft.yaml
97
+ make build .dockerignore
72
98
- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
73
99
uses : casperdcl/deploy-pypi@v1
74
100
with :
@@ -77,21 +103,17 @@ jobs:
77
103
skip_existing : true
78
104
- id : collect_assets
79
105
name : Collect assets
80
- shell : bash
81
106
run : |
82
107
echo "::set-output name=asset_path::$(ls dist/*.whl)"
83
108
echo "::set-output name=asset_name::$(basename dist/*.whl)"
84
109
echo "::set-output name=asset_path_sig::$(ls dist/*.whl.asc 2>/dev/null)"
85
110
echo "::set-output name=asset_name_sig::$(basename dist/*.whl.asc 2>/dev/null)"
86
111
if [[ $GITHUB_REF == refs/tags/v* ]]; then
87
112
echo ::set-output name=docker_tags::latest,${GITHUB_REF/refs\/tags\/v/}
88
- echo ::set-output name=snap_channel::stable
89
113
elif [[ $GITHUB_REF == refs/heads/master ]]; then
90
114
echo ::set-output name=docker_tags::master
91
- echo ::set-output name=snap_channel::candidate
92
115
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
93
116
echo ::set-output name=docker_tags::devel
94
- echo ::set-output name=snap_channel::edge
95
117
fi
96
118
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
97
119
- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
@@ -122,46 +144,47 @@ jobs:
122
144
asset_path : ${{ steps.collect_assets.outputs.asset_path_sig }}
123
145
asset_name : ${{ steps.collect_assets.outputs.asset_name_sig }}
124
146
asset_content_type : text/plain
125
- - name : Snap install
126
- uses : samuelmeuli/action-snapcraft@v1
127
- with :
128
- use_lxd : true
129
- - name : Snap build
130
- shell : bash
131
- run : |
132
- export SNAPCRAFT_IMAGE_INFO='{"build_url": "https://github.com/casperdcl/git-fame/actions/runs/'$GITHUB_RUN_ID'"}'
133
- sg lxd -c 'snapcraft --use-lxd'
134
- env :
135
- SNAPCRAFT_BUILD_INFO : 1 # https://snapcraft.io/blog/introducing-developer-notifications-for-snap-security-updates
136
- - if : github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
137
- name : Snap login
138
- uses : samuelmeuli/action-snapcraft@v1
139
- with :
140
- skip_install : true
141
- snapcraft_token : ${{ secrets.SNAP_TOKEN }}
142
- - if : github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
143
- name : Snap deploy
144
- shell : bash
145
- run : |
146
- if [ -n "$(ls git-fame*.snap 2>/dev/null)" ]; then
147
- sudo snapcraft upload git-fame*.snap --release $CHANNEL
148
- fi
149
- env :
150
- CHANNEL : ${{ steps.collect_assets.outputs.snap_channel }}
151
147
- name : Docker build push
152
148
uses : elgohr/Publish-Docker-Github-Action@master
153
149
with :
154
- name : ${{ github.actor }}/git-fame
150
+ name : ${{ github.repository }}
155
151
tags : ${{ steps.collect_assets.outputs.docker_tags }}
156
152
password : ${{ secrets.DOCKER_PWD }}
157
153
username : ${{ secrets.DOCKER_USR }}
158
154
no_push : ${{ steps.collect_assets.outputs.docker_tags == '' }}
159
155
- name : Docker push GitHub
160
156
uses : elgohr/Publish-Docker-Github-Action@master
161
157
with :
162
- name : ${{ github.actor }}/git-fame /git-fame
158
+ name : ${{ github.repository }}/git-fame
163
159
tags : ${{ steps.collect_assets.outputs.docker_tags }}
164
160
password : ${{ github.token }}
165
161
username : ${{ github.actor }}
166
162
registry : docker.pkg.github.com
167
163
no_push : ${{ steps.collect_assets.outputs.docker_tags == '' }}
164
+ deploy-snap :
165
+ if : github.event_name != 'pull_request' || github.head_ref != 'devel'
166
+ name : Deploy Snap
167
+ needs : [check, test]
168
+ runs-on : ubuntu-latest
169
+ steps :
170
+ - uses : actions/checkout@v2
171
+ with :
172
+ fetch-depth : 0
173
+ - id : snap_channel
174
+ name : Snap channel
175
+ run : |
176
+ if [[ $GITHUB_REF == refs/tags/v* ]]; then
177
+ echo ::set-output name=release::stable,candidate
178
+ elif [[ $GITHUB_REF == refs/heads/master ]]; then
179
+ echo ::set-output name=release::candidate
180
+ elif [[ $GITHUB_REF == refs/heads/devel ]]; then
181
+ echo ::set-output name=release::edge
182
+ fi
183
+ - id : snap_build
184
+ uses : snapcore/action-build@v1
185
+ - if : github.event_name == 'push' && steps.snap_channel.outputs.release
186
+ uses : snapcore/action-publish@v1
187
+ with :
188
+ store_login : ${{ secrets.SNAP_TOKEN }}
189
+ snap : ${{ steps.snap_build.outputs.snap }}
190
+ release : ${{ steps.snap_channel.outputs.release }}
0 commit comments