Skip to content

Workflow file for this run

name: Test, Release, and Publish
on:
push:
branches:
- "main"
- "master"
permissions:
contents: write
jobs:
tests:
runs-on: ubuntu-latest
# services:
# redis:
# image: redis
# ports:
# - 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
pip install pytest pytest-cov build twine
- name: Check installation
run: pip list | grep hashstash
- name: Run tests with coverage
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
pytest --cov=./ --cov-report=xml
env:
REDIS_URL: redis://localhost:6379
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: quadrismegistus/hashstash
github-release:
name: "GitHub Release"
needs: [tests]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: "Releasing"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Latest Build"
pypi-release:
name: "PyPI Release"
needs: [tests, github-release]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[extra,dev,test]
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
twine upload dist/*