Skip to content

Commit 5c6ce59

Browse files
authored
bump version, merge pull request #51 from casperdcl/devel
2 parents 639102f + ad7e1fc commit 5c6ce59

23 files changed

+474
-368
lines changed

.gitattributes

-7
This file was deleted.

.github/workflows/comment-bot.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Comment Bot
22
on:
33
issue_comment:
4-
types: [created, edited]
4+
types: [created]
55
pull_request_review_comment:
6-
types: [created, edited]
7-
6+
types: [created]
87
jobs:
98
tag: # /tag <tagname> <commit>
109
if: startsWith(github.event.comment.body, '/tag ')
@@ -21,7 +20,6 @@ jobs:
2120
post = (context.eventName == "issue_comment"
2221
? github.reactions.createForIssueComment
2322
: github.reactions.createForPullRequestReviewComment)
24-
2523
if (!["admin", "write"].includes(perm.data.permission)){
2624
post({
2725
owner: context.repo.owner, repo: context.repo.repo,
@@ -50,7 +48,3 @@ jobs:
5048
post({
5149
owner: context.repo.owner, repo: context.repo.repo,
5250
comment_id: context.payload.comment.id, content: "rocket"})
53-
always:
54-
runs-on: ubuntu-latest
55-
steps:
56-
- run: echo prevent failure when other jobs are skipped

.github/workflows/test.yml

+68-45
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,59 @@ on:
66
- cron: '3 2 1 * *' # M H d m w (monthly at 2:03)
77
jobs:
88
check:
9+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
910
name: Check
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
1316
- uses: actions/setup-python@v2
1417
with:
1518
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
1726
run: |
1827
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
2242
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
2446
test:
47+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
2548
strategy:
2649
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]
2851
name: Python ${{ matrix.python }}
2952
runs-on: ubuntu-latest
3053
steps:
3154
- uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 0
3257
- uses: actions/setup-python@v2
3358
with:
3459
python-version: ${{ matrix.python }}
3560
- name: Install
36-
run: |
37-
pip install -U tox setuptools_scm
61+
run: pip install -U tox
3862
- name: Test
3963
run: tox -e py${PYVER/./}
4064
env:
@@ -45,30 +69,32 @@ jobs:
4569
with:
4670
parallel: true
4771
finish:
72+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
4873
name: Coverage
4974
needs: test
5075
runs-on: ubuntu-latest
5176
steps:
5277
- 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
5479
with:
5580
parallel-finished: true
5681
deploy:
82+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
5783
name: Deploy
58-
needs: [check, test, finish]
84+
needs: [check, test]
5985
runs-on: ubuntu-latest
6086
steps:
6187
- uses: actions/checkout@v2
88+
with:
89+
fetch-depth: 0
6290
- uses: actions/setup-python@v2
6391
with:
6492
python-version: '3.x'
6593
- name: Install
6694
run: |
6795
sudo apt-get install -yqq pandoc
68-
pip install setuptools_scm
69-
git fetch --unshallow --tags
7096
pip install .[dev]
71-
make build .dockerignore snapcraft.yaml
97+
make build .dockerignore
7298
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
7399
uses: casperdcl/deploy-pypi@v1
74100
with:
@@ -77,21 +103,17 @@ jobs:
77103
skip_existing: true
78104
- id: collect_assets
79105
name: Collect assets
80-
shell: bash
81106
run: |
82107
echo "::set-output name=asset_path::$(ls dist/*.whl)"
83108
echo "::set-output name=asset_name::$(basename dist/*.whl)"
84109
echo "::set-output name=asset_path_sig::$(ls dist/*.whl.asc 2>/dev/null)"
85110
echo "::set-output name=asset_name_sig::$(basename dist/*.whl.asc 2>/dev/null)"
86111
if [[ $GITHUB_REF == refs/tags/v* ]]; then
87112
echo ::set-output name=docker_tags::latest,${GITHUB_REF/refs\/tags\/v/}
88-
echo ::set-output name=snap_channel::stable
89113
elif [[ $GITHUB_REF == refs/heads/master ]]; then
90114
echo ::set-output name=docker_tags::master
91-
echo ::set-output name=snap_channel::candidate
92115
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
93116
echo ::set-output name=docker_tags::devel
94-
echo ::set-output name=snap_channel::edge
95117
fi
96118
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
97119
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
@@ -122,46 +144,47 @@ jobs:
122144
asset_path: ${{ steps.collect_assets.outputs.asset_path_sig }}
123145
asset_name: ${{ steps.collect_assets.outputs.asset_name_sig }}
124146
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 }}
151147
- name: Docker build push
152148
uses: elgohr/Publish-Docker-Github-Action@master
153149
with:
154-
name: ${{ github.actor }}/git-fame
150+
name: ${{ github.repository }}
155151
tags: ${{ steps.collect_assets.outputs.docker_tags }}
156152
password: ${{ secrets.DOCKER_PWD }}
157153
username: ${{ secrets.DOCKER_USR }}
158154
no_push: ${{ steps.collect_assets.outputs.docker_tags == '' }}
159155
- name: Docker push GitHub
160156
uses: elgohr/Publish-Docker-Github-Action@master
161157
with:
162-
name: ${{ github.actor }}/git-fame/git-fame
158+
name: ${{ github.repository }}/git-fame
163159
tags: ${{ steps.collect_assets.outputs.docker_tags }}
164160
password: ${{ github.token }}
165161
username: ${{ github.actor }}
166162
registry: docker.pkg.github.com
167163
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 }}

.gitignore

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
*.so
55

66
# Packages
7-
*.egg-info
8-
build/
9-
dist/
10-
snapcraft.yaml
11-
git-fame_*_amd64.snap
12-
.dockerignore
7+
/gitfame/_dist_ver.py
8+
/.eggs/
9+
/*.egg-info
10+
/build/
11+
/dist/
12+
/git-fame_*_amd64.snap
13+
/.dockerignore
1314

1415
# Unit test / coverage reports
1516
.tox/
1617
.coverage
17-
__pycache__
18+
__pycache__/
1819
nosetests.xml
1920

2021
# Translations

.meta/.snapcraft.yml

-24
This file was deleted.

.pre-commit-config.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
default_language_version:
2+
python: python3
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.3.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-case-conflict
9+
- id: check-docstring-first
10+
- id: check-executables-have-shebangs
11+
- id: check-toml
12+
- id: check-yaml
13+
- id: end-of-file-fixer
14+
- id: mixed-line-ending
15+
- id: trailing-whitespace
16+
- hooks:
17+
- id: flake8
18+
additional_dependencies:
19+
- flake8-bugbear
20+
- flake8-comprehensions
21+
- flake8-debugger
22+
- flake8-string-format
23+
repo: https://gitlab.com/pycqa/flake8
24+
rev: 3.8.4
25+
- hooks:
26+
- id: isort
27+
repo: https://github.com/timothycrosley/isort
28+
rev: 5.6.4

LICENCE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* files: *
2-
MPLv2.0 2016-2019 (c) Casper da Costa-Luis
2+
MPLv2.0 2016-2020 (c) Casper da Costa-Luis
33
[casperdcl](https://github.com/casperdcl).
44

55

MANIFEST.in

-13
This file was deleted.

Makefile

+3-10
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,8 @@ gitfame/git-fame.1: .meta/.git-fame.1.md gitfame/_gitfame.py
7171
cat "$<" - |\
7272
pandoc -o "$@" -s -t man
7373

74-
snapcraft.yaml: .meta/.snapcraft.yml
75-
cat "$<" | sed -e "s/{version}/$$(python -m gitfame --version 2>&1)/g" \
76-
-e "s/{commit}/$$(git describe --always)/g" \
77-
-e 's/{source}/./g' > "$@"
78-
7974
.dockerignore:
80-
echo '*' > $@
81-
echo '!dist/*.whl' >> $@
75+
@+python -c "fd=open('.dockerignore', 'w'); fd.write('*\n!dist/*.whl\n')"
8276

8377
distclean:
8478
@+make coverclean
@@ -88,6 +82,8 @@ prebuildclean:
8882
@+python -c "import shutil; shutil.rmtree('build', True)"
8983
@+python -c "import shutil; shutil.rmtree('dist', True)"
9084
@+python -c "import shutil; shutil.rmtree('git_fame.egg-info', True)"
85+
@+python -c "import shutil; shutil.rmtree('.eggs', True)"
86+
@+python -c "import os; os.remove('gitfame/_dist_ver.py') if os.path.exists('gitfame/_dist_ver.py') else None"
9187
coverclean:
9288
@+python -c "import os; os.remove('.coverage') if os.path.exists('.coverage') else None"
9389
@+python -c "import shutil; shutil.rmtree('gitfame/__pycache__', True)"
@@ -122,9 +118,6 @@ buildupload:
122118
@make build
123119
@make pypi
124120

125-
snap:
126-
@make -B snapcraft.yaml
127-
snapcraft
128121
docker:
129122
@make build
130123
@make .dockerignore

0 commit comments

Comments
 (0)