Updated CHANGELOG.md #1082
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
release-python-version: "3.10" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[typing,lint,test,pandas] | |
- name: Lint with flake8 | |
run: | | |
flake8 . | |
- name: Test with pytest | |
run: | | |
pytest | |
- name: Format using black | |
run: | | |
black --check . | |
- name: Sort imports with isort | |
run: | | |
isort --diff --check . | |
- name: Build protobuf files | |
run: python setup.py build_protobuf | |
- name: Run mypy | |
run: | | |
mypy --strict metricq examples tests setup.py | |
build: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.release-python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.release-python-version }} | |
- name: Install Protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Build Python distribution | |
run: pip wheel --wheel-dir dist/ . | |
- name: Upload distribution artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: distribution-packages | |
path: dist/metricq-*.whl | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- name: Download distribution artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: distribution-packages | |
path: dist/ | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
- name: Reformat version number | |
id: reformat_release | |
uses: frabert/replace-string-action@v1.1 | |
with: | |
pattern: 'refs\/tags\/v([0-9.]+)' | |
string: ${{ github.ref }} | |
replace-with: "$1" | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get last tag | |
id: get_last_tag | |
run: echo "::set-output name=last_tag::$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))" | |
- name: Generate release changelog | |
uses: charmixer/auto-changelog-action@v1.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
since_tag: ${{ steps.get_last_tag.outputs.last_tag }} | |
base: "none.md" # ignore the HISTORY.md file | |
output: release-changelog.md | |
- name: Upload release changelog artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-changelog | |
path: release-changelog.md | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Python Release ${{ steps.reformat_release.outputs.replaced }} | |
draft: false | |
prerelease: false | |
body_path: release-changelog.md | |
docs: | |
needs: [build] | |
runs-on: ubuntu-latest | |
env: | |
OUTPUT_DIR: build/sphinx | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.release-python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.release-python-version }} | |
- name: Install Protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: | | |
pip install '.[docs]' | |
- name: Build documentation | |
run: | | |
# run HTML builder (-b) in nitpicky mode (-n) in a fresh environment (-E) | |
sphinx-build -b html -n -E docs ${{ env.OUTPUT_DIR }} | |
- name: Upload generated HTML as build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.OUTPUT_DIR }} | |
name: docs | |
- name: Deploy documentation to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
with: | |
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: ${{ env.OUTPUT_DIR }} |