Skip to content

Commit

Permalink
chore: Unify the name for folders, makefile rules and dependency grou…
Browse files Browse the repository at this point in the history
…ps. (#284)
  • Loading branch information
huxuan authored Jan 26, 2024
1 parent 6679b8b commit fcc88df
Show file tree
Hide file tree
Showing 31 changed files with 127 additions and 127 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: env | sort
- run: make dev
- run: make lint test docs build
- run: make lint test doc build
strategy:
matrix:
python-version:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- name: Check PR Title for Conventional Commit Format
run: |
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|doc|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
echo 'The title does not conform to the Conventional Commit.'
echo 'Please refer to "https://www.conventionalcommits.org/"'
exit 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
cache: true
python-version: '3.12'
- run: env | sort
- run: make dev-docs
- run: make docs
- run: make dev-doc
- run: make doc
- name: Upload changelog
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/ci/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ ci:
script:
- env | sort
- make dev
- make lint test docs build
- make lint test doc build
stage: ci
2 changes: 1 addition & 1 deletion .gitlab/ci/mr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lint_title:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- |
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq '^(build|chore|ci|doc|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
echo "The title does not conform to the Conventional Commit."
echo "Please refer to 'https://www.conventionalcommits.org/'"
exit 1
Expand Down
10 changes: 5 additions & 5 deletions .gitlab/ci/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docs:
doc:
artifacts:
paths:
- public
Expand All @@ -8,8 +8,8 @@ docs:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- env | sort
- make dev-docs
- make docs
- make dev-doc
- make doc
- make release-notes > release-notes.md
stage: release
package:
Expand All @@ -27,7 +27,7 @@ pages:
- public
needs:
- release
- docs
- doc
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
Expand All @@ -36,7 +36,7 @@ pages:
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- docs
- doc
release:
description: release-notes.md
tag_name: $CI_COMMIT_TAG
Expand Down
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
build:
jobs:
post_build:
- make docs-mypy
- make docs-coverage
- make doc-mypy
- make doc-coverage
post_checkout:
- git fetch --unshallow || true
post_install:
- python -m pip install --upgrade --no-cache-dir pdm
- make dev-docs
- make dev-doc
pre_build:
- make changelog
os: ubuntu-22.04
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish docs-autobuild changelog docs-gen docs-mypy docs-coverage docs
.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish doc-autobuild changelog doc-gen doc-mypy doc-coverage doc

########################################################################################
# Variables
Expand Down Expand Up @@ -118,7 +118,7 @@ publish:
########################################################################################

# Generate documentation with auto build when changes happen.
docs-autobuild:
doc-autobuild:
pdm run $(PDM_GLOBAL) python -m sphinx_autobuild docs $(PUBLIC_DIR) \
--watch README.md \
--watch src
Expand All @@ -130,27 +130,27 @@ changelog:
echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \
wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \
fi
pdm run $(PDM_GLOBAL) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test
pdm run $(PDM_GLOBAL) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,doc,feat,fix,perf,refactor,revert,style,test

# Generate release notes from changelog.
release-notes:
pdm run $(PDM_GLOBAL) git-changelog --input $(CHANGELOG_PATH) --release-notes

# Build documentation only from src.
docs-gen:
doc-gen:
pdm run $(PDM_GLOBAL) python -m sphinx.cmd.build docs $(PUBLIC_DIR)

# Generate mypy reports.
docs-mypy: docs-gen
pdm run $(PDM_GLOBAL) python -m mypy src test --html-report $(PUBLIC_DIR)/reports/mypy
doc-mypy: doc-gen
pdm run $(PDM_GLOBAL) python -m mypy src tests --html-report $(PUBLIC_DIR)/reports/mypy

# Generate html coverage reports with badge.
docs-coverage: test-run docs-gen
doc-coverage: test-run doc-gen
pdm run $(PDM_GLOBAL) python -m coverage html -d $(PUBLIC_DIR)/reports/coverage
pdm run $(PDM_GLOBAL) bash scripts/generate-coverage-badge.sh $(PUBLIC_DIR)/_static/badges

# Generate all documentation with reports.
docs: changelog docs-gen docs-mypy docs-coverage
doc: changelog doc-gen doc-mypy doc-coverage

########################################################################################
# End
Expand Down
6 changes: 3 additions & 3 deletions docs/dev/commit.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Examples:

```text
build(dependencies): bump the prod group with 9 updates.
docs: Add docs for commit convention.
doc: Add doc for commit convention.
chore: remove deprecated key in ruff config.
```

Expand All @@ -24,7 +24,7 @@ Type
| `build` | Changes that affect the build system or dependencies. |
| `chore` | Routine tasks or changes outside the src/runtime code. |
| `ci` | Changes related to continuous integration. |
| `docs` | Documentation changes. |
| `doc` | Documentation changes. |
| `feat` | New features. |
| `fix` | Bug fixes. |
| `perf` | Performance improvements. |
Expand Down Expand Up @@ -55,6 +55,6 @@ In this way, individual commit within development branches does not need to stri
A CI/CD pipeline checks the titles of pull/merge requests against the following regex pattern:
```text
^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*
^(build|chore|ci|doc|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*
```
````
8 changes: 4 additions & 4 deletions docs/dev/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ make install

### Documentation generation

Install the project in editable mode with `docs` related dependencies,
Install the project in editable mode with `doc` related dependencies,
recommended for scenarios like documentation generation CI/CD process.

```bash
make dev-docs
make dev-doc
```

### Lint check
Expand Down Expand Up @@ -117,9 +117,9 @@ make dev-test

````{admonition} Install a combination of the optional dependencies
:class: tip, dropdown
For example, to install dependencies for `docs` and `lint`, we can use the following command.
For example, to install dependencies for `doc` and `lint`, we can use the following command.
```bash
make dev-docs,lint
make dev-doc,lint
```
````
Loading

0 comments on commit fcc88df

Please sign in to comment.