Skip to content

Commit

Permalink
add CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
brennerm committed Feb 24, 2021
1 parent 91d8fc4 commit dc31e96
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "*"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: install
run: pip install .
- name: run all checks
run: aws-quota-checker check all
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1

publish:
runs-on: ubuntu-latest
needs: test
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: install
run: pip install .[dev]
- name: get changelog entry
id: changelog
run: python tools/extract-changelog-entry.py ${GITHUB_REF#refs/tags/} > changelog_entry
- name: build package
run: python setup.py bdist_wheel
- name: publish package
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: aqc-token
password: ${{ secrets.PYPI_API_TOKEN }}
- name: create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: changelog_entry
draft: true
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='aws-quota-checker',
version='0.1',
version='1.0.0',
packages=find_packages(),
install_requires=[
'boto3',
Expand All @@ -12,7 +12,9 @@
extras_require={
'dev':{
'autopep8',
'pylint'
'pylint',
'keepachangelog',
'wheel'
}
},
entry_points='''
Expand Down
19 changes: 19 additions & 0 deletions tools/extract-changelog-entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sys

import keepachangelog

CATEGORIES = ['added', 'changed', 'deprecated', 'removed', 'fixed', 'security']

version = sys.argv[1]

changes = keepachangelog.to_dict("CHANGELOG.md")[version]

print('## Changelog')
for category in CATEGORIES:
entries = changes.get(category, [])

if entries:
print(f'### {category.capitalize()}')

for entry in entries:
print(f'- {entry}')

0 comments on commit dc31e96

Please sign in to comment.