Skip to content

Commit aaa7035

Browse files
authored
Merge branch 'main' into support-themes
2 parents 4d53825 + c4be684 commit aaa7035

38 files changed

+982
-606
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ updates:
99
directory: /
1010
schedule:
1111
interval: "monthly"
12+
groups:
13+
github-action:
14+
patterns:
15+
- "*"
1216
- package-ecosystem: pip
1317
directory: /
1418
schedule:
1519
interval: "monthly"
20+
groups:
21+
pip:
22+
patterns:
23+
- "*"

.github/workflows/docs-preview.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Read the Docs PR preview
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
documentation-links:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: readthedocs/actions/preview@v1
21+
with:
22+
project-slug: "gitstats"
23+
single-version: "true"

.github/workflows/publish-image.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ jobs:
2828
uses: actions/checkout@v4
2929
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
3030
- name: Log in to the Container registry
31-
uses: docker/login-action@v3.3.0
31+
uses: docker/login-action@v3.4.0
3232
with:
3333
registry: ${{ env.REGISTRY }}
3434
username: ${{ github.actor }}
3535
password: ${{ secrets.GITHUB_TOKEN }}
3636
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
3737
- name: Extract metadata (tags, labels) for Docker
3838
id: meta
39-
uses: docker/metadata-action@v5.6.1
39+
uses: docker/metadata-action@v5.7.0
4040
with:
4141
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4242
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
4343
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
4444
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
4545
- name: Build and push Docker image
4646
id: push
47-
uses: docker/build-push-action@v6.9.0
47+
uses: docker/build-push-action@v6.18.0
4848
with:
4949
context: .
5050
push: true
@@ -53,7 +53,7 @@ jobs:
5353

5454
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
5555
- name: Generate artifact attestation
56-
uses: actions/attest-build-provenance@v2.1.0
56+
uses: actions/attest-build-provenance@v2.4.0
5757
with:
5858
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
5959
subject-digest: ${{ steps.push.outputs.digest }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Remove PR Preview
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
cleanup-preview:
9+
if: github.event.pull_request.merged == true
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout gh-pages branch
14+
uses: actions/checkout@v4
15+
with:
16+
ref: gh-pages
17+
persist-credentials: true
18+
19+
- name: Remove preview folder
20+
run: |
21+
rm -rf previews/${{ github.event.pull_request.number }} || true
22+
23+
- name: Commit and push changes
24+
run: |
25+
git config user.name "github-actions[bot]"
26+
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
git add -A
28+
git commit -m "Remove preview for PR #${{ github.event.pull_request.number }}"
29+
git push

.github/workflows/test.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,28 @@ on:
55
paths:
66
- '**/*.py'
77
- 'pyproject.toml'
8-
- 'gitstats.conf'
8+
- 'gitstats/*'
99
- '.github/workflows/test.yml'
1010
push:
1111
branches:
1212
- "main"
1313
workflow_dispatch:
1414

1515
jobs:
16+
test-docs:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
- name: Set up Python 3.12
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: 3.12
25+
- name: Build Docs
26+
run: |
27+
pip install nox
28+
nox -s docs
29+
1630
test-windows:
1731
runs-on: windows-latest
1832
strategy:
@@ -26,7 +40,7 @@ jobs:
2640
fetch-depth: 0 # get all history.
2741

2842
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
43+
uses: actions/setup-python@v5
3044
with:
3145
python-version: ${{ matrix.python-version }}
3246

@@ -42,14 +56,14 @@ jobs:
4256
.\venv\Scripts\activate.bat
4357
# for testing
4458
pip install .
45-
gitstats . gitstats-report-windows
59+
gitstats . test-report-windows -f json
4660
4761
- name: Save GitStats Report
4862
if: ${{ matrix.python-version == '3.9' }}
4963
uses: actions/upload-artifact@v4
5064
with:
51-
name: gitstats-report-windows
52-
path: gitstats-report-windows
65+
name: test-report-windows
66+
path: test-report-windows
5367

5468
test-macos:
5569
runs-on: macos-latest
@@ -64,7 +78,7 @@ jobs:
6478
fetch-depth: 0 # get all history.
6579

6680
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v4
81+
uses: actions/setup-python@v5
6882
with:
6983
python-version: ${{ matrix.python-version }}
7084

@@ -78,20 +92,20 @@ jobs:
7892
source venv/bin/activate
7993
# for testing
8094
pip install .
81-
gitstats . gitstats-report-macos
95+
gitstats . test-report-macos -f json
8296
8397
- name: Save GitStats Report
8498
if: ${{ matrix.python-version == '3.9' }}
8599
uses: actions/upload-artifact@v4
86100
with:
87-
name: gitstats-report-macos
88-
path: gitstats-report-macos
101+
name: test-report-macos
102+
path: test-report-macos
89103

90104
test-linux:
91105
runs-on: ubuntu-latest
92106
strategy:
93107
matrix:
94-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
108+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-beta.1"]
95109

96110
steps:
97111
- name: Checkout Code
@@ -100,36 +114,33 @@ jobs:
100114
fetch-depth: 0 # get all history.
101115

102116
- name: Set up Python ${{ matrix.python-version }}
103-
uses: actions/setup-python@v4
117+
uses: actions/setup-python@v5
104118
with:
105119
python-version: ${{ matrix.python-version }}
106120

107121
- name: Install Dependencies
108122
run: |
109-
sudo apt-get update
110-
sudo apt-get install -y gnuplot
123+
pip install nox
124+
nox -s install-deps
111125
112126
- name: Generate GitStats Report
113127
run: |
114-
python3 -m venv venv
115-
source venv/bin/activate
116-
# for testing
117-
pip install .
118-
gitstats . gitstats-report
128+
pip install nox
129+
nox -s build
119130
120131
- name: Save GitStats Report
121132
if: ${{ matrix.python-version == '3.9' }}
122133
uses: actions/upload-artifact@v4
123134
with:
124-
name: gitstats-report
125-
path: gitstats-report
135+
name: test-report
136+
path: test-report
126137

127138
- name: Deploy to GitHub Pages for PR
128139
if: ${{ github.event_name == 'pull_request' && matrix.python-version == '3.9' }}
129140
uses: peaceiris/actions-gh-pages@v4
130141
with:
131142
github_token: ${{ secrets.GITHUB_TOKEN }}
132-
publish_dir: gitstats-report
143+
publish_dir: test-report
133144
# Configure a unique preview link for each pull request
134145
destination_dir: previews/${{ github.event.pull_request.number }}
135146

@@ -138,7 +149,7 @@ jobs:
138149
uses: peaceiris/actions-gh-pages@v4
139150
with:
140151
github_token: ${{ secrets.GITHUB_TOKEN }}
141-
publish_dir: gitstats-report
152+
publish_dir: test-report
142153
keep_files: true # do not remove example reports
143154

144155
- name: Add PR Comment with Preview Link

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
venv/
22
.venv/
3+
__pycache__
34
gitstats/__pycache__/
45
gitstats.egg-info
56
gitstory.egg-info
67
build/
78
gitstats-report
89
test-report
10+
test-report.json
11+
docs/build

.gitpod.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66

77
tasks:
88
- name: Install & Build
9-
init: sudo apt-get install -y --no-install-recommends gnuplot
10-
command: make preview
9+
init: |
10+
pip install nox
11+
nox -s install-deps
12+
nox -s build
13+
command: nox -s preview

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Xianpeng Shen <[email protected]>
2+
Pinhong Ma <[email protected]>

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
autoupdate_schedule: quarterly
3+
14
repos:
25
- repo: https://github.com/pre-commit/pre-commit-hooks
36
rev: v5.0.0
@@ -7,10 +10,19 @@ repos:
710
- id: end-of-file-fixer
811
- id: trailing-whitespace
912
- id: requirements-txt-fixer
13+
14+
- repo: https://github.com/pre-commit/pygrep-hooks
15+
rev: "v1.10.0"
16+
hooks:
17+
- id: rst-backticks
18+
- id: rst-directive-colons
19+
- id: rst-inline-touching-normal
20+
1021
- repo: https://github.com/pre-commit/mirrors-mypy
1122
rev: v1.13.0
1223
hooks:
1324
- id: mypy
25+
additional_dependencies: [types-requests]
1426
- repo: https://github.com/astral-sh/ruff-pre-commit
1527
# Ruff version.
1628
rev: v0.8.6

.readthedocs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version, and other tools you might need
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "3.12" # use 3.12 because 3.13 removed imghdr module, it will cause error
12+
13+
# Build documentation in the "docs/" directory with Sphinx
14+
sphinx:
15+
configuration: docs/source/conf.py
16+
fail_on_warning: true
17+
18+
# Optionally, but recommended,
19+
# declare the Python requirements required to build your documentation
20+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
21+
python:
22+
install:
23+
- requirements: docs/requirements.txt

0 commit comments

Comments
 (0)