Skip to content

Commit

Permalink
refactor: Incorporate 3.1.0 version of The Common Project Template(in…
Browse files Browse the repository at this point in the history
…consistent release description fix)

Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
  • Loading branch information
brlin-tw committed Oct 1, 2024
1 parent c984c30 commit b4b513d
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file is based on The Common EditorConfig Template project
# https://github.com/the-common/editorconfig-template
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2021 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: WTFPL

# This is the top-most EditorConfig file
Expand Down
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# * Git - gitattributes Documentation
# https://www.git-scm.com/docs/gitattributes
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Avoid exporting development files to release archive
/.* export-ignore
/continuous-integration/ export-ignore
/continuous-integration export-ignore

# Keep editorconfig for ease of editing of product files
/.editorconfig -export-ignore
4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# workflows

放置 [GitHub Actions](https://github.com/features/actions) 的工作流程(workflow)定義檔
Workflow definition files of the [GitHub Actions Continuous Integration(CI) service](https://github.com/features/actions)

## 參考資料<br>Reference
## Reference

* [Features • GitHub Actions](https://github.com/features/actions)
Product page
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/check-potential-problems.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# 用來檢查專案中的潛在問題的 GitHub Actions 工作流程(workflow)定義檔
# GitHub Actions workflow for checking potential problems in the project
#
# 編輯參考:
# References:
#
# * Workflow syntax for GitHub Actions - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
# Copyright 2022 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: 檢查專案中的潛在問題
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
name: Check potential problems in the project
on:
push:
branches:
- '**'
jobs:
check-using-precommit:
name: 使用 pre-commit 檢查專案中的潛在問題
name: Check potential problems using pre-commit
runs-on: ubuntu-22.04
env:
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit
SHELLCHECK_DIR: ${{ github.workspace }}/.cache/shellcheck-stable
steps:
- name: 自版控庫取出內容
- name: Check out content from the Git repository
uses: actions/checkout@v4

- name: Configure PyPI data cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pip
path: ${{ env.PIP_CACHE_DIR }}

- name: >-
Configure pre-commit data cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ${{ env.PRE_COMMIT_HOME }}
- name: >-
Configure pre-built ShellCheck cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-${{ runner.arch }}-shellcheck
path: ${{ env.SHELLCHECK_DIR }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# * Workflow syntax for GitHub Actions - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
name: Release product and their build aritfacts
on:
push:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
run: ./continuous-integration/generate-release-description.sh

- name: Publish the release archive to the GitHub Releases
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@v2
with:
name: ${{ env.project_id }} ${{ env.release_version }}
files: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# This file is based on The Common .gitignore Templates
# https://github.com/the-common/gitignore-templates
#
# Copyright 2022 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2022 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Don't track regular Unix hidden files
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * `.gitlab-ci.yml` keyword reference | GitLab
# https://docs.gitlab.com/ee/ci/yaml/
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
do-static-analysis:
stage: test
Expand Down
30 changes: 16 additions & 14 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
# Markdownlint(Node.js variant) configuration file
# https://github.com/igorshubovych/markdownlint-cli#configuration
#
# This file is based on The Common Markdownlint(Node.js variant) Configuration Templates project
# https://github.com/Lin-Buo-Ren/common-markdownlint-nodejs-config-templates
# This file is based on The Common Markdownlint(Node.js variant)
# Configuration Templates project
# https://github.com/the-common/markdownlint-nodejs-config-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Inherit Markdownlint rules
default: True

# Only allow consistent un-ordered list bullet style(allow alternations in sub-levels)
MD004:
# Only allow consistent un-ordered list bullet style(allow alternations
# in sub-levels)
ul-style:
style: sublist

# Only allow 4 spaces as indentation of lists
MD007:
ul-indent:
indent: 4

# Only allow 2 spaces as linebreak sequence
MD009:
no-trailing-spaces:
br_spaces: 2

# Disable line length limitation(not suitable with CJK context)
MD013: False
line-length: False

# Allow missing padding blank line between the heading markup and the context
MD022: False
blanks-around-headings: False

# Allow duplicated non-sibling heading text
MD024:
no-duplicate-heading:
siblings_only: True

# Allow missing padding blank line between a list and its context
MD032: False
blanks-around-lists: False

# Allow using raw HTML markups as workarounds of deficiencies of Markdown
MD033: False
no-inline-html: False

# 佔位字是要被替換掉的,為此規則之特例
MD036: false
no-emphasis-as-heading: false

# Allow using YAML front matter, while not require the definition of the
# `title` property
MD041:
first-line-h1:
front_matter_title: '.*'
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This file is based on The Common Pre-commit Framework Configuration Template
# https://github.com/Lin-Buo-Ren/common-precommit-config-template
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2021 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

repos:
Expand Down Expand Up @@ -35,7 +35,7 @@ repos:
# Check Markdown documents with Markdownlint(Node.js variant)
# https://github.com/DavidAnson/markdownlint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.23.2
rev: v0.34.0
hooks:
- id: markdownlint

Expand Down
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# This file is based on The Unofficial yamllint Configuration Templates
# https://github.com/Lin-Buo-Ren/yamllint-configuration-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2021 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
rules:
# Use this rule to control the number of spaces inside braces (`{` and `}`).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

## 參考資料

本章節列舉開發本專案期間所參考的第三方資料
以下列舉撰寫本主題內容時所參考的第三方資源

* [Machine-readable debian/copyright file](https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/)
說明 REUSE DEP5 檔案的撰寫格式
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/create-gitlab-release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Create GitLab project release
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

set \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# System dependency installation logic for the static analysis program
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
set \
-o errexit \
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/do-static-analysis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Check potential problems in the project
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
set \
-o errexit \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Install system dependencies required for generating the project
# build artifacts
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# Copyright 2024 林博仁(Buo-ren Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

set \
Expand Down
20 changes: 16 additions & 4 deletions continuous-integration/generate-build-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Generate the project build artifacts
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# Copyright 2024 林博仁(Buo-ren Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
set \
-o errexit \
Expand All @@ -20,6 +20,8 @@ if ! script="$(
fi

script_dir="${script%/*}"
project_dir="${script_dir%/*}"
project_dirname="${project_dir##*/}"

if ! test -e "${script_dir}/venv"; then
printf \
Expand Down Expand Up @@ -54,6 +56,15 @@ if ! pip show git-archive-all &>/dev/null; then
fi
fi

printf \
'Info: Determining the build datestamp...\n'
if ! datestamp="$(date +%Y%m%d-%H%M%S)"; then
printf \
'Error: Unable to determine the build datestamp.\n' \
1>&2
exit 2
fi

printf \
'Info: Determining the project version...\n'
git_describe_opts=(
Expand All @@ -65,16 +76,17 @@ if ! version_describe="$(
git describe \
"${git_describe_opts[@]}"
)"; then
version_describe="unknown-${datestamp}"
printf \
'Error: Unable to determine the project version.\n' \
'Warning: Unable to determine the project version, will use "%s" as a fallback.\n' \
"${version_describe}" \
1>&2
exit 2
fi
project_version="${version_describe#v}"

printf \
'Info: Generating the project archive...\n'
project_id="${CI_PROJECT_NAME:-"${project_id}"}"
project_id="${CI_PROJECT_NAME:-"${PROJECT_ID:-"${project_dirname}"}"}"
release_id="${project_id}-${project_version}"
git_archive_all_opts=(
# Add an additional layer of folder for containing the archive
Expand Down
8 changes: 4 additions & 4 deletions continuous-integration/generate-release-description.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Generate release description text to explain the changes between the
# previous release
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

set \
Expand Down Expand Up @@ -43,6 +43,9 @@ if test -v CI_COMMIT_TAG; then
release_tag="${CI_COMMIT_TAG}"
fi

git_log_opts=(
--format='format:* %s (%h) - %an'
)
if test "${git_tag_count}" -eq 1; then
printf \
'Info: Only one release tag was detected, generating the release description text from the very beginning to the "%s" release tag...\n' \
Expand Down Expand Up @@ -104,9 +107,6 @@ else
"${previous_git_tag}" \
"${release_tag}" \
1>&2
git_log_opts=(
--format='format:* %s (%h) - %an'
)
if ! detailed_changes_markup+="$(
git log \
"${git_log_opts[@]}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# * Including other files from within sudoers | Sudoers Manual | Sudo
# https://www.sudo.ws/docs/man/sudoers.man/#Including_other_files_from_within_sudoers
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# Copyright 2024 林博仁(Buo-ren Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Configure the interpreter behavior to bail out during problematic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# * Default environment - variablesVariables - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Whether we are in an CI environment
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/upload-gitlab-generic-packages.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
# Upload release packages as GitLab generic packages
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

set \
Expand Down
Loading

0 comments on commit b4b513d

Please sign in to comment.