Skip to content

Commit 61a0c3c

Browse files
committed
chore(ci): adding missing hrefs in changelogs and added specs to benchmarks
1 parent 7c3a453 commit 61a0c3c

3 files changed

Lines changed: 63 additions & 4 deletions

File tree

.github/workflows/CI.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,44 @@ jobs:
393393
run: cargo publish
394394
env:
395395
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
396+
397+
release:
398+
name: Create GitHub Release
399+
needs: [publish_to_pypi, publish]
400+
runs-on: ubuntu-latest
401+
if: startsWith(github.ref, 'refs/tags/v')
402+
steps:
403+
- name: Checkout code
404+
uses: actions/checkout@v4
405+
with:
406+
fetch-depth: 0 # get all tags
407+
408+
- name: Get release notes
409+
id: get_release_notes
410+
run: |
411+
# Get the latest tag
412+
latest_tag=$(git describe --tags --abbrev=0)
413+
echo "latest_tag=${latest_tag}" >> $GITHUB_ENV
414+
415+
# Extract release notes from CHANGELOG.md
416+
# This script extracts the content between the latest tag and the previous tag.
417+
notes=$(awk -v tag="## [${latest_tag##v}]" '
418+
BEGIN { p = 0 }
419+
$0 ~ tag { p = 1; next }
420+
p && /^## / { exit }
421+
p { print }
422+
' CHANGELOG.md)
423+
echo "notes<<EOF" >> $GITHUB_OUTPUT
424+
echo "$notes" >> $GITHUB_OUTPUT
425+
echo "EOF" >> $GITHUB_OUTPUT
426+
427+
- name: Create Release
428+
uses: softprops/action-gh-release@v1
429+
with:
430+
tag_name: ${{ env.latest_tag }}
431+
name: "Release ${{ env.latest_tag }}"
432+
body: ${{ steps.get_release_notes.outputs.notes }}
433+
draft: false
434+
prerelease: contains(github.ref, 'alpha') || contains(github.ref, 'beta')
435+
env:
436+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

benches/compare_benches.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
import json
2+
import platform
23
import sys
34
from pathlib import Path
45

56
import pandas as pd
7+
import psutil
8+
9+
10+
def get_system_specs():
11+
return {
12+
"OS": f"{platform.system()} {platform.release()}",
13+
"Architecture": platform.machine(),
14+
"CPU Model": platform.processor(),
15+
"CPU Cores": f"{psutil.cpu_count(logical=True)} logical, {psutil.cpu_count(logical=False)} physical",
16+
"Memory": f"{psutil.virtual_memory().total / (1024**3):.2f} GB",
17+
}
618

719

820
def compare_benchmarks():
@@ -36,6 +48,13 @@ def compare_benchmarks():
3648
"This file is automatically generated by the CI. Do not edit manually.\n\n"
3749
)
3850

51+
# Add system specs
52+
specs = get_system_specs()
53+
f.write("## System Specifications\n\n")
54+
for key, value in specs.items():
55+
f.write(f"- **{key}:** {value}\n")
56+
f.write("\n")
57+
3958
for benchmark, group in df.groupby("benchmark"):
4059
f.write(f"### {str(benchmark).capitalize()} Benchmark\n")
4160

cliff.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body = """
1919
{% for group, commits in commits | group_by(attribute="group") %}
2020
### {{ group | upper_first }}
2121
{% for commit in commits %}
22-
- {% if commit.scope %}(**{{ commit.scope }}**) {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}])
22+
- {% if commit.scope %}(**{{ commit.scope }}**) {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/PyDataBlog/simstring_rs/commit/{{ commit.id }}))
2323
{% endfor %}
2424
{% endfor %}
2525
@@ -65,7 +65,6 @@ tag_pattern = "v[0-9].*"
6565
skip_tags = "v0.1.0-beta.1"
6666
# regex for ignoring tags
6767
ignore_tags = ""
68-
link_parsers = [
69-
{ pattern = "\\b[a-f0-9]{7}\\b", href = "https://github.com/PyDataBlog/simstring_rs/commit/$0" },
70-
{ pattern = "#(\\d+)", href = "https://github.com/PyDataBlog/simstring_rs/issues/$1" },
68+
commit_preprocessors = [
69+
{ pattern = "\\(#(\\d+)\\)", replace = "[#$1](https://github.com/PyDataBlog/simstring_rs/issues/$1)" },
7170
]

0 commit comments

Comments
 (0)