Skip to content

Commit

Permalink
Stop tracking version and add action to explicitly handle releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tdg5 committed Apr 7, 2024
1 parent 1371df7 commit 56e23ca
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main]

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

Expand Down Expand Up @@ -36,54 +36,42 @@ jobs:
if ! `git diff --quiet`; then
echo "pip freeze caused file changes, failing!"
git diff
exit 1
fi
- name: Check style
run: |
source venv/bin/activate
make style
if ! `git diff --quiet`; then
echo "make style caused file changes, failing!"
git diff
exit 1
fi
- name: Run tests and build package
run: |
source venv/bin/activate
make nose
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_REQLESS="$(cat VERSION)"
coverage report | tee .meta/coverage/report.txt
coverage-badge -f -o .meta/coverage/badge.svg
python -m build
- name: Checkout tdg5/github-action-pack
uses: actions/checkout@v4
with:
path: .github/actions/tdg5/github-action-pack
ref: v0.0.4
ref: v0.0.5
repository: tdg5/github-action-pack

- name: Increment version
uses: ./.github/actions/tdg5/github-action-pack/packages/increment-version-file-action/src
- name: Commit and push code coverage snapshot
uses: ./.github/actions/tdg5/github-action-pack/packages/stage-files-and-commit-and-push-action/src
with:
authorEmail: dannyguinther+spamburglar@gmail.com
authorName: Spamburglar
commitMessage: "[skip actions] Increment version for next development cycle"
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/*
# 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"
commitMessage: "[skip actions] Update code coverage snapshot"
optionalFilePaths: |
.meta/coverage/badge.svg
.meta/coverage/report.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Style, test, build, and publish the package
name: Style, test, and build package

on:
push:
branches-ignore: [main]

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

steps:
Expand Down Expand Up @@ -50,5 +50,5 @@ jobs:
run: |
source venv/bin/activate
make nose
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_REQLESS="$(cat VERSION)"
coverage report
python -m build
94 changes: 94 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: '1.2.3'

jobs:
test-and-build-and-publish-and-release:
env:
VERSION: ${{ github.event.inputs.version }}
name: Test, build, publish, and release the package
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
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
- name: Check requirements.txt is up to date
run: |
source venv/bin/activate
pip install .[all]
pip uninstall -y reqless
pip freeze > requirements.txt
if ! `git diff --quiet`; then
echo "pip freeze caused file changes, failing!"
git diff
exit 1
fi
- name: Check style
run: |
source venv/bin/activate
make style
if ! `git diff --quiet`; then
echo "make style caused file changes, failing!"
git diff
exit 1
fi
- name: Run tests and build package
run: |
source venv/bin/activate
make nose
coverage report | tee .meta/coverage/report.txt
coverage-badge -f -o .meta/coverage/badge.svg
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_REQLESS="$VERSION"
python -m build
- 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/*
- name: Configure git actor
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Create and push tag for published version
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_ACTIONS }}
RELEASE_NAME: v${{ github.event.inputs.version }}
run: |
git tag -m "$RELEASE_NAME" "$RELEASE_NAME"
git push origin "$RELEASE_NAME"
gh release create \
--generate-notes \
--target "$GITHUB_REF" \
--title "$RELEASE_NAME" \
"$RELEASE_NAME"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
build/*
dist/*
htmlcov/*
qless_with_throttles.egg-info/*
reqless.egg-info/*
.vagrant
MANIFEST
.tox/
Expand Down
21 changes: 21 additions & 0 deletions .meta/coverage/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions .meta/coverage/report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Name Stmts Miss Cover
-----------------------------------------------------------------------------------------------------
/usr/lib/python3/dist-packages/pkg_resources/__init__.py 1532 1497 2%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/_structures.py 41 40 2%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py 72 62 14%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/specifiers.py 306 294 4%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py 160 140 12%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py 2513 2301 8%
/usr/lib/python3/dist-packages/pkg_resources/_vendor/six.py 444 442 1%
/usr/lib/python3/dist-packages/pkg_resources/extern/__init__.py 36 33 8%
qmore/__init__.py 0 0 100%
qmore/client.py 42 1 98%
reqless/__init__.py 146 1 99%
reqless/abstract/__init__.py 15 0 100%
reqless/abstract/abstract_client.py 23 0 100%
reqless/abstract/abstract_config.py 18 0 100%
reqless/abstract/abstract_job.py 56 0 100%
reqless/abstract/abstract_job_data.py 6 0 100%
reqless/abstract/abstract_job_processor.py 20 1 95%
reqless/abstract/abstract_jobs.py 10 0 100%
reqless/abstract/abstract_queue.py 27 0 100%
reqless/abstract/abstract_queue_identifiers_transformer.py 4 0 100%
reqless/abstract/abstract_queue_jobs.py 8 0 100%
reqless/abstract/abstract_queue_resolver.py 4 0 100%
reqless/abstract/abstract_queues.py 7 0 100%
reqless/abstract/abstract_throttle.py 11 0 100%
reqless/abstract/abstract_throttles.py 4 0 100%
reqless/abstract/abstract_workers.py 6 0 100%
reqless/config.py 50 0 100%
reqless/exceptions.py 4 0 100%
reqless/importer.py 26 0 100%
reqless/job.py 280 15 95%
reqless/listener.py 49 0 100%
reqless/logger.py 13 0 100%
reqless/proctitle.py 3 0 100%
reqless/queue.py 89 0 100%
reqless/queue_resolvers/__init__.py 4 0 100%
reqless/queue_resolvers/qmore_dynamic_mapping_queue_identifiers_transformer.py 50 0 100%
reqless/queue_resolvers/qmore_dynamic_priority_queue_identifiers_transformer.py 61 0 100%
reqless/queue_resolvers/transforming_queue_resolver.py 13 0 100%
reqless/throttle.py 29 0 100%
reqless/util.py 7 0 100%
reqless/workers/__init__.py 2 0 100%
reqless/workers/forking.py 55 2 96%
reqless/workers/greenlet.py 50 0 100%
reqless/workers/serial.py 29 0 100%
reqless/workers/util.py 39 1 97%
reqless/workers/worker.py 78 3 96%
reqless_test/__init__.py 0 0 100%
reqless_test/common.py 31 1 97%
reqless_test/test_client.py 144 6 96%
reqless_test/test_config.py 43 0 100%
reqless_test/test_events.py 36 1 97%
reqless_test/test_forking.py 61 6 90%
reqless_test/test_greenlet.py 67 15 78%
reqless_test/test_importer.py 18 0 100%
reqless_test/test_job.py 257 5 98%
reqless_test/test_job_processor_api.py 31 2 94%
reqless_test/test_listener.py 34 0 100%
reqless_test/test_qmore_client.py 57 0 100%
reqless_test/test_qmore_dynamic_mapping_queue_identifiers_transformer.py 123 0 100%
reqless_test/test_qmore_dynamic_priority_queue_identifiers_transformer.py 133 0 100%
reqless_test/test_queue.py 78 0 100%
reqless_test/test_serial.py 91 0 100%
reqless_test/test_transforming_queue_resolver.py 20 0 100%
reqless_test/test_worker.py 53 0 100%
reqless_test/test_worker_util.py 64 3 95%
-----------------------------------------------------------------------------------------------------
TOTAL 7783 4872 37%
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
args: [--markdown-linebreak-ext=md]
exclude: reqless/lua|reqless/qless-core
- id: end-of-file-fixer
exclude: README.md|VERSION|reqless/lua|reqless/qless-core
exclude: README.md|reqless/lua|reqless/qless-core
- id: check-docstring-first
- id: debug-statements
- id: name-tests-test
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![code coverage](https://github.com/tdg5/reqless-py/raw/main/.meta/coverage/badge.svg)](https://raw.githubusercontent.com/tdg5/reqless-py/main/.meta/coverage/report.txt)
[![license](https://img.shields.io/github/license/tdg5/reqless-py.svg)](https://github.com/tdg5/reqless-py/blob/main/LICENSE)

# reqless

This is a fork of [seomoz/qless-py](https://github.com/seomoz/qless-py) that
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dev = [
]
test = [
"coverage",
"coverage-badge~=1.1.0",
"mock",
"nose",
"rednose",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
coverage==7.3.0
coverage-badge==1.1.0
cryptography==42.0.5
decorator==5.1.1
distlib==0.3.7
Expand Down

0 comments on commit 56e23ca

Please sign in to comment.