Skip to content

Commit

Permalink
Add github action to check style and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdg5 committed Dec 22, 2023
1 parent 780c6c5 commit 32e9963
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 21 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/main-build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test, build, and publish the package

on:
push:
branches: [main]

jobs:
test-build-and-publish:
name: Test, build, and publish the package
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: qless-py
submodules: true
token: ${{ secrets.PAT_GITHUB_ACTIONS }}

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y redis-server
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
working-directory: qless-py

- name: Check style
run: |
source venv/bin/activate
make style
working-directory: qless-py

- name: Run tests and build package
run: |
source venv/bin/activate
make nose
python -m build
working-directory: qless-py

- name: Checkout tdg5/github-action-pack
uses: actions/checkout@v4
with:
path: .github/actions/tdg5/github-action-pack
ref: v0.0.2
repository: tdg5/github-action-pack

- name: Increment version
uses: ./.github/actions/tdg5/github-action-pack/packages/increment-version-file-action/src
with:
authorEmail: dannyguinther@gmail.com
authorName: Danny Guinther
commitMessage: "[skip actions] Increment version for next development cycle"
repoPath: qless-py
versionFilePath: VERSION
versionFormat: python

- name: Publish package to pypi
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_USERNAME: __token__
run: |
source venv/bin/activate
python -m twine upload dist/*
working-directory: qless-py

# Add the tag after publishing the package so it is more likely that we
# end up with a package without a tag than a tag without a package.
- name: Create and push tag for published version
run: |
VERSION="$(git show HEAD~1:VERSION)"
TAG_NAME="v${VERSION}"
git tag "$TAG_NAME" HEAD~1
git push origin "$TAG_NAME"
working-directory: qless-py
47 changes: 47 additions & 0 deletions .github/workflows/other-check-quality-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Style, test, build, and publish the package

on:
push:
branches-ignore: [main]

jobs:
style-test-and-build:
name: Test, build, and publish the package
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: qless-py
submodules: true

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y redis-server
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
working-directory: qless-py

- name: Check style
run: |
source venv/bin/activate
make style
git diff --quiet
if [ ! $? -eq 0 ]; then
echo "make style caused file changes, failing!"
exit 1
fi
working-directory: qless-py

- name: Run tests and build package
run: |
source venv/bin/activate
make nose
python -m build
working-directory: qless-py
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

20 changes: 20 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
appdirs==1.4.4
async-timeout==4.0.3
black==21.5b2
build==1.0.3
certifi==2023.11.17
cffi==1.16.0
cfgv==3.4.0
Expand All @@ -11,6 +12,7 @@ coverage==7.3.0
cryptography==41.0.5
decorator==5.1.1
distlib==0.3.7
docutils==0.20.1
dparse==0.6.3
filelock==3.13.1
funcsigs==0.4
Expand All @@ -19,40 +21,58 @@ greenlet==2.0.1
hiredis==2.2.3
identify==2.5.32
idna==3.4
importlib-metadata==6.8.0
isort==5.8.0
jaraco.classes==3.3.0
jeepney==0.8.0
keyring==24.3.0
markdown-it-py==3.0.0
mdurl==0.1.2
mock==1.3.0
more-itertools==10.1.0
mypy==1.7.0
mypy-extensions==1.0.0
nh3==0.2.15
nodeenv==1.8.0
nose==1.3.7
packaging==21.3
pathspec==0.11.2
pbr==1.8.1
pkginfo==1.9.6
platformdirs==4.0.0
pre-commit==2.20.0
pycparser==2.21
pyflakes==3.1.0
Pygments==2.17.2
pyparsing==3.1.1
pyproject_hooks==1.0.0
python-termstyle==0.1.10
PyYAML==6.0.1
readme-renderer==42.0
redis==5.0.0
rednose==1.1.1
regex==2023.10.3
removestar==1.3.1
requests==2.31.0
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.7.0
ruamel.yaml==0.18.5
ruamel.yaml.clib==0.2.8
safety==2.3.5
SecretStorage==3.3.3
setproctitle==1.3.2
six==1.16.0
toml==0.10.2
tomli==2.0.1
twine==4.0.2
types-decorator==5.1.8.4
types-mock==5.1.0.2
types-pyOpenSSL==23.3.0.0
types-redis==4.6.0.11
typing_extensions==4.8.0
urllib3==2.1.0
virtualenv==20.24.7
zipp==3.17.0
zope.event==5.0
zope.interface==6.0
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ def _long_description() -> Tuple[str, str]:

_dev_dependencies = [
"black==21.5b2",
"build==1.0.3",
"click<8.1",
"isort==5.8.0",
"mypy~=1.7.0",
"pre-commit==2.20.0",
"removestar==1.3.1",
"safety==2.3.5",
"twine==4.0.2",
"types-decorator==5.1.8.4",
"types-mock==5.1.0.2",
]
Expand Down

0 comments on commit 32e9963

Please sign in to comment.