Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

env:
PYTHON_VERSION: "3.15"
NODE_VERSION: "26.13.0"
RUFF_VERSION: "0.17.3"
PLAYWRIGHT_VERSION: "1.64.1"

jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Ruff
run: pipx run "ruff==${RUFF_VERSION}" check --select E9,F repo-stats
- name: ShellCheck
run: shellcheck release_notes_generator.sh

test:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: repo-stats
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Playwright + Chromium (for browser tests)
run: |
npm install --no-save --no-package-lock "playwright@${PLAYWRIGHT_VERSION}"
npx playwright install --with-deps chromium
- name: Run tests
run: python3 -m unittest discover -s tests -v
18 changes: 9 additions & 9 deletions release_notes_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

read -r -d '' USAGE << EOM
read -r -d '' USAGE << 'EOM'
Usage: release_notes_helper.sh [-j JIRAKEY] [-s SCOPES] <START_VERSION> [END_VERSION]

example 1 (from a release tag to main, for an upcoming tag): ./release_notes_helper.sh v1.1.0 origin/main
Expand All @@ -26,18 +26,18 @@ while getopts ":j:s:h" opt; do
;;
h) echo "${USAGE}" && exit 0
;;
\? ) echo "${USAGE}" && exit -2
\? ) echo "${USAGE}" && exit 2
;;
esac
done

START_VERSION=${@:$OPTIND:1}
START_VERSION=${*:$OPTIND:1}
if [ -z "${START_VERSION}" ]; then
echo "${USAGE}"
exit -1
exit 1
fi

END_VERSION=${@:$OPTIND+1:1}
END_VERSION=${*:$OPTIND+1:1}
if [ -z "${END_VERSION}" ]; then
END_VERSION="HEAD"
fi
Expand All @@ -59,7 +59,7 @@ echo ""
echo "Generating release notes from ${START_VERSION} to ${END_VERSION}"
echo "Copy the lines below into the release notes."
echo "-----"
git log ${START_VERSION}...${END_VERSION} --pretty=format:"- [(%h)](${CI_PROJECT_URL}/commit/%H) %s" --reverse |
git log "${START_VERSION}...${END_VERSION}" --pretty=format:"- [(%h)](${CI_PROJECT_URL}/commit/%H) %s" --reverse |
grep "${SCOPES}" |
sort -k 3,3 |
sed -e $'s/*/\\n */g' |
Expand Down Expand Up @@ -93,9 +93,9 @@ git log ${START_VERSION}...${END_VERSION} --pretty=format:"- [(%h)](${CI_PROJECT
echo "-----"

# TODO: remove blanks when Issue does not exist
issues=($(git log ${START_VERSION}...${END_VERSION} --pretty=format:'%s' --reverse | grep -oe "${ISSUEPREFIX}[0-9]\+"))
unique=($(echo "${issues[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
mapfile -t issues < <(git log "${START_VERSION}...${END_VERSION}" --pretty=format:'%s' --reverse | grep -oe "${ISSUEPREFIX}[0-9]\+")
mapfile -t unique < <(printf '%s\n' "${issues[@]}" | grep . | sort -u)
echo "Commit range includes ${#unique[@]} Issues"
list=$(IFS=, ; echo "${unique[*]}")
# If JIRAKEY is set, output JIRA query
[[ ! -z "$JIRAKEY" ]] && echo "project=${JIRAKEY} and id in (${list})"
[[ -n "$JIRAKEY" ]] && echo "project=${JIRAKEY} and id in (${list})"
3 changes: 1 addition & 2 deletions repo-stats/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import Any, Iterable, Mapping, Sequence, cast

import helpers
from helpers import add_remote, collect, rs
from helpers import collect, rs
import fixtures
from fixtures import DAY, Repo, lines
import mock_servers as ms
Expand Down Expand Up @@ -242,7 +242,6 @@ def build_api_data() -> dict[str, Any]:
created = merged - int(rnd.lognormvariate(10.5, 1.0))
first_commit = created - int(rnd.uniform(600, 90000))
ready = created + int(rnd.choice([0, 0, 0, 1800, 20000]))
state = "MERGED"
author, atype = "alice", "User"
if i % 10 == 3:
author, atype = "dependabot[bot]", "Bot"
Expand Down