Skip to content

Commit

Permalink
refactor: fix: 引入 2.1.8 版的 The Common Project Template(REUSE pre-comm…
Browse files Browse the repository at this point in the history
…it 掛勾程序報錯修正)

Signed-off-by: 林博仁(Buo-ren, Lin) <[email protected]>
  • Loading branch information
brlin-tw committed Jun 21, 2024
1 parent 6e5b8a9 commit 11f101a
Show file tree
Hide file tree
Showing 24 changed files with 549 additions and 57 deletions.
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ insert_final_newline = true
trim_trailing_whitespace = true

# Git configuration files uses tabs as indentation units
[.git*]
[/.git{modules,config}]
indent_style = tab

# Avoid git patch fail to apply due to stripped unmodified lines that contains only spaces
Expand Down Expand Up @@ -59,3 +59,8 @@ indent_size = 2

[.*.{yml,yaml}]
indent_size = 2

# Keep the indentation style of the license text verbatim
[/LICENSES/*]
indent_size = unset
indent_style = unset
19 changes: 17 additions & 2 deletions .github/workflows/check-potential-problems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
# SPDX-License-Identifier: CC-BY-SA-4.0
name: 檢查專案中的潛在問題
on:
- push
push:
branches:
- '**'
jobs:
check-using-precommit:
name: 使用 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: 自版控庫取出內容
uses: actions/checkout@v4
Expand All @@ -34,7 +37,19 @@ jobs:
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ${{ env.PRE_COMMIT_HOME }}
- name: Running static analysis program
- name: >-
Configure pre-built ShellCheck cache to speed up continuous integration
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-shellcheck
path: ${{ env.SHELLCHECK_DIR }}
- name: >-
Patch the sudo security policy so that programs run via sudo
will recognize environment variables predefined by GitHub
run: sudo ./continuous-integration/patch-github-actions-sudo-security-policy.sh
- name: Run the static analysis programs
run: |
sudo ./continuous-integration/do-static-analysis.install-system-deps.sh
./continuous-integration/do-static-analysis.sh
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,27 @@ jobs:
name: Release product and their build aritfacts
runs-on: ubuntu-20.04
steps:
- name: Checkout content from the Git repository
- name: Check out content from the Git repository
uses: actions/checkout@v4
with:
# Increase fetch depth if you may have more than this amount
# of revisions between releases
fetch-depth: 100

# Fetch tags as well to generate detailed changes between two releases
# WORKAROUND: Adding this option triggers actions/checkout#1467
#fetch-tags: true

- name: >-
WORKAROUND: Fetch tags that points to the revisions
checked-out(actions/checkout#1467)
run: |-
git fetch \
--prune \
--prune-tags \
--force \
--depth=100 \
--no-recurse-submodules
- name: Determine the project identifier
run: printf "project_id=${GITHUB_REPOSITORY##*/}\\n" >> $GITHUB_ENV
Expand All @@ -33,6 +52,11 @@ jobs:
- name: Determine the release identifier
run: printf "release_id=${project_id}-${release_version}\\n" >> $GITHUB_ENV

- name: >-
Patch the sudo security policy so that programs run via sudo
will recognize environment variables predefined by GitHub
run: sudo ./continuous-integration/patch-github-actions-sudo-security-policy.sh
- name: Generate the release archive
run: |-
sudo ./continuous-integration/generate-build-artifacts.install-system-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# https://github.com/the-common/gitignore-templates
#
# Copyright 2022 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# 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
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# https://docs.gitlab.com/ee/ci/yaml/
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
do-static-analysis:
stage: test
rules:
Expand All @@ -16,12 +16,14 @@ do-static-analysis:
variables:
PIP_CACHE_DIR: ${CI_PROJECT_DIR}/.cache/pip
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
SHELLCHECK_DIR: ${CI_PROJECT_DIR}/.cache/shellcheck-stable
cache:
# Enable per-job and per-branch caching
key: $CI_JOB_NAME-$CI_COMMIT_REF_SLUG
paths:
- ${PIP_CACHE_DIR}
- ${PRE_COMMIT_HOME}
- ${SHELLCHECK_DIR}

script:
- ./continuous-integration/do-static-analysis.install-system-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# https://git-scm.com/docs/gitmodules
#
# Copyright 2021 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
2 changes: 1 addition & 1 deletion .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# https://github.com/Lin-Buo-Ren/common-markdownlint-nodejs-config-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

# Inherit Markdownlint rules
default: True
Expand Down
25 changes: 23 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# https://github.com/Lin-Buo-Ren/common-precommit-config-template
#
# Copyright 2021 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

repos:
# Some out-of-the-box hooks for pre-commit
Expand Down Expand Up @@ -42,13 +42,34 @@ repos:
# Check REUSE compliance
# https://reuse.software/
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
rev: v3.0.2
hooks:
- id: reuse

# Check shell scripts with ShellCheck
# NOTE: ShellCheck must be available in the command search PATHs
# https://www.shellcheck.net/
# https://github.com/jumanjihouse/pre-commit-hooks#shellcheck
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck

# Check YAML files
# https://github.com/adrienverge/yamllint
- repo: https://github.com/adrienverge/yamllint
rev: v1.30.0
hooks:
- id: yamllint

# Check EditorConfig style compliance
# https://github.com/editorconfig-checker/editorconfig-checker.python
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
alias: ec
exclude: |
(?ix)^(
LICENSES/.*
)$
10 changes: 5 additions & 5 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Upstream-Contact: Issues · libre-knowledge/subject-template <https://gitlab.com
Source: https://gitlab.com/libre-knowledge/subject-template

Files:
*README.md
*/README.md
_config.yml
Copyright: Copyright 2023 自由知識協作平台貢獻者 <https://gitlab.com/libre-knowledge/libre-knowledge/-/issues>
License: CC-BY-SA-4.0
*README.md
*/README.md
_config.yml
Copyright: Copyright 2024 自由知識協作平台貢獻者 <https://gitlab.com/libre-knowledge/libre-knowledge/-/issues>
License: CC-BY-SA-4.0+ OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# https://github.com/Lin-Buo-Ren/yamllint-configuration-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# 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 `}`).
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.braces
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# The Apache-2.0-If-Not-Used-In-Template-Projects pseudo license

Assets that are declared as either licensed under [the 4.0 International
version of the Creative Commons Attribution-ShareAlike license](https://creativecommons.org/licenses/by-sa/4.0/)
or this pseudo license can be licensed otherwise under [the 2.0 version
of the Apache license](https://www.apache.org/licenses/LICENSE-2.0) _if_
it is used to instantiate/refactor a project based on it rather than
using it in the making of another template project. This allows
re-licensing the project assets to your liking in your non-template
projects with only a legal conformance requirement of attributing this
product somewhere in your project/product credits/acknowledgment/copyright
notice documentation/user interface.

Note that some assets that are not declared using this pseudo license
may also allow re-licensing as the declared license does not impose such
restrictions in the first place, refer the individual license terms for
details.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
+ .markdownlint.yml
1. 編輯子模組專案 [real.README.md 主題說明文件模板](real.README.md),將 `_佔位字_` 替換為適當之內容(別忘了替換 `libre-knowledge/_專案ID_`),並移除未使用之(待補)章節
1. 用 [real.markdownlint.yml Markdownlint 配置文件](real.markdownlint.yml)替換掉 [.markdownlint.yml 本專案專屬的 Markdownlint 配置文件](.markdownlint.yml)
1. 將「real.gitattributes Git 路徑屬性配置文件」更名為「.gitattributes」
1. 替換 [.reuse/dep5 REUSE DEP5 機器可讀著作權宣告文件](.reuse/dep5)文件中的 `Upstream-Name`(替換為 _主題名稱_)欄位、 `Upstream-Contact`(替換為該主題專案議題追蹤系統的網頁標題與網址)欄位跟 `Source`(替換為專案網址)欄位
1. 將 [real.README.md 主題說明文件模板](real.README.md) 替換掉 [README.md 本專案說明文件](README.md)
1. 將變更提交為新修訂版(參考提交標題: `docs: 撰寫主題說明文件雛型`
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/create-gitlab-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Create GitLab project release
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-License-Identifier: CC-BY-SA-4.0 OR LicenseRef-Apache-2.0-If-Not-Used-In-Template-Projects

set \
-o errexit \
Expand Down
Loading

0 comments on commit 11f101a

Please sign in to comment.