Skip to content

Commit

Permalink
bump version, merge pull request #51 from casperdcl/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Dec 2, 2020
2 parents 639102f + ad7e1fc commit 5c6ce59
Show file tree
Hide file tree
Showing 23 changed files with 474 additions and 368 deletions.
7 changes: 0 additions & 7 deletions .gitattributes

This file was deleted.

10 changes: 2 additions & 8 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Comment Bot
on:
issue_comment:
types: [created, edited]
types: [created]
pull_request_review_comment:
types: [created, edited]

types: [created]
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
Expand All @@ -21,7 +20,6 @@ jobs:
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
Expand Down Expand Up @@ -50,7 +48,3 @@ jobs:
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
always:
runs-on: ubuntu-latest
steps:
- run: echo prevent failure when other jobs are skipped
113 changes: 68 additions & 45 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,59 @@ on:
- cron: '3 2 1 * *' # M H d m w (monthly at 2:03)
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Test
run: |
pip install -U tox
pip install -U .
- name: Test
run: tox
tox
env:
TOXENV: 'setup.py,nodeps'
- name: Self install
run: pip install -U .[dev]
- name: Build
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- uses: reviewdog/action-setup@v1
- if: github.event_name != 'schedule'
name: flake8
run: |
pre-commit run -a flake8 | reviewdog -f=pep8 -name=Format -tee -reporter=github-check -filter-mode nofilter
env:
TOXENV: 'flake8,setup.py,nodeps'
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8]
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install
run: |
pip install -U tox setuptools_scm
run: pip install -U tox
- name: Test
run: tox -e py${PYVER/./}
env:
Expand All @@ -45,30 +69,32 @@ jobs:
with:
parallel: true
finish:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Coverage
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: exoplanet-dev/coveralls-python-action@develop # https://github.com/AndreMiras/coveralls-python-action/pull/5
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
deploy:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Deploy
needs: [check, test, finish]
needs: [check, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install
run: |
sudo apt-get install -yqq pandoc
pip install setuptools_scm
git fetch --unshallow --tags
pip install .[dev]
make build .dockerignore snapcraft.yaml
make build .dockerignore
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: casperdcl/deploy-pypi@v1
with:
Expand All @@ -77,21 +103,17 @@ jobs:
skip_existing: true
- id: collect_assets
name: Collect assets
shell: bash
run: |
echo "::set-output name=asset_path::$(ls dist/*.whl)"
echo "::set-output name=asset_name::$(basename dist/*.whl)"
echo "::set-output name=asset_path_sig::$(ls dist/*.whl.asc 2>/dev/null)"
echo "::set-output name=asset_name_sig::$(basename dist/*.whl.asc 2>/dev/null)"
if [[ $GITHUB_REF == refs/tags/v* ]]; then
echo ::set-output name=docker_tags::latest,${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=snap_channel::stable
elif [[ $GITHUB_REF == refs/heads/master ]]; then
echo ::set-output name=docker_tags::master
echo ::set-output name=snap_channel::candidate
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
echo ::set-output name=docker_tags::devel
echo ::set-output name=snap_channel::edge
fi
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
Expand Down Expand Up @@ -122,46 +144,47 @@ jobs:
asset_path: ${{ steps.collect_assets.outputs.asset_path_sig }}
asset_name: ${{ steps.collect_assets.outputs.asset_name_sig }}
asset_content_type: text/plain
- name: Snap install
uses: samuelmeuli/action-snapcraft@v1
with:
use_lxd: true
- name: Snap build
shell: bash
run: |
export SNAPCRAFT_IMAGE_INFO='{"build_url": "https://github.com/casperdcl/git-fame/actions/runs/'$GITHUB_RUN_ID'"}'
sg lxd -c 'snapcraft --use-lxd'
env:
SNAPCRAFT_BUILD_INFO: 1 # https://snapcraft.io/blog/introducing-developer-notifications-for-snap-security-updates
- if: github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
name: Snap login
uses: samuelmeuli/action-snapcraft@v1
with:
skip_install: true
snapcraft_token: ${{ secrets.SNAP_TOKEN }}
- if: github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
name: Snap deploy
shell: bash
run: |
if [ -n "$(ls git-fame*.snap 2>/dev/null)" ]; then
sudo snapcraft upload git-fame*.snap --release $CHANNEL
fi
env:
CHANNEL: ${{ steps.collect_assets.outputs.snap_channel }}
- name: Docker build push
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.actor }}/git-fame
name: ${{ github.repository }}
tags: ${{ steps.collect_assets.outputs.docker_tags }}
password: ${{ secrets.DOCKER_PWD }}
username: ${{ secrets.DOCKER_USR }}
no_push: ${{ steps.collect_assets.outputs.docker_tags == '' }}
- name: Docker push GitHub
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.actor }}/git-fame/git-fame
name: ${{ github.repository }}/git-fame
tags: ${{ steps.collect_assets.outputs.docker_tags }}
password: ${{ github.token }}
username: ${{ github.actor }}
registry: docker.pkg.github.com
no_push: ${{ steps.collect_assets.outputs.docker_tags == '' }}
deploy-snap:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Deploy Snap
needs: [check, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: snap_channel
name: Snap channel
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
echo ::set-output name=release::stable,candidate
elif [[ $GITHUB_REF == refs/heads/master ]]; then
echo ::set-output name=release::candidate
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
echo ::set-output name=release::edge
fi
- id: snap_build
uses: snapcore/action-build@v1
- if: github.event_name == 'push' && steps.snap_channel.outputs.release
uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.SNAP_TOKEN }}
snap: ${{ steps.snap_build.outputs.snap }}
release: ${{ steps.snap_channel.outputs.release }}
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
*.so

# Packages
*.egg-info
build/
dist/
snapcraft.yaml
git-fame_*_amd64.snap
.dockerignore
/gitfame/_dist_ver.py
/.eggs/
/*.egg-info
/build/
/dist/
/git-fame_*_amd64.snap
/.dockerignore

# Unit test / coverage reports
.tox/
.coverage
__pycache__
__pycache__/
nosetests.xml

# Translations
Expand Down
24 changes: 0 additions & 24 deletions .meta/.snapcraft.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- hooks:
- id: isort
repo: https://github.com/timothycrosley/isort
rev: 5.6.4
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* files: *
MPLv2.0 2016-2019 (c) Casper da Costa-Luis
MPLv2.0 2016-2020 (c) Casper da Costa-Luis
[casperdcl](https://github.com/casperdcl).


Expand Down
13 changes: 0 additions & 13 deletions MANIFEST.in

This file was deleted.

13 changes: 3 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,8 @@ gitfame/git-fame.1: .meta/.git-fame.1.md gitfame/_gitfame.py
cat "$<" - |\
pandoc -o "$@" -s -t man

snapcraft.yaml: .meta/.snapcraft.yml
cat "$<" | sed -e "s/{version}/$$(python -m gitfame --version 2>&1)/g" \
-e "s/{commit}/$$(git describe --always)/g" \
-e 's/{source}/./g' > "$@"

.dockerignore:
echo '*' > $@
echo '!dist/*.whl' >> $@
@+python -c "fd=open('.dockerignore', 'w'); fd.write('*\n!dist/*.whl\n')"

distclean:
@+make coverclean
Expand All @@ -88,6 +82,8 @@ prebuildclean:
@+python -c "import shutil; shutil.rmtree('build', True)"
@+python -c "import shutil; shutil.rmtree('dist', True)"
@+python -c "import shutil; shutil.rmtree('git_fame.egg-info', True)"
@+python -c "import shutil; shutil.rmtree('.eggs', True)"
@+python -c "import os; os.remove('gitfame/_dist_ver.py') if os.path.exists('gitfame/_dist_ver.py') else None"
coverclean:
@+python -c "import os; os.remove('.coverage') if os.path.exists('.coverage') else None"
@+python -c "import shutil; shutil.rmtree('gitfame/__pycache__', True)"
Expand Down Expand Up @@ -122,9 +118,6 @@ buildupload:
@make build
@make pypi

snap:
@make -B snapcraft.yaml
snapcraft
docker:
@make build
@make .dockerignore
Expand Down
Loading

0 comments on commit 5c6ce59

Please sign in to comment.