Skip to content

Commit

Permalink
refactor: Incorporating version 2.0.3 of The Common Project Template
Browse files Browse the repository at this point in the history
For supporting continuous integration(CI) for quality assurances.

The following components are excluded from the template, as it is not used in this project:

* GitLab related assets
* Continuous delivery logic

Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
  • Loading branch information
brlin-tw committed Dec 5, 2023
0 parents commit 52c94a6
Show file tree
Hide file tree
Showing 18 changed files with 1,284 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# EditorConfig is awesome
# http://EditorConfig.org
#
# 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>
# SPDX-License-Identifier: WTFPL

# This is the top-most EditorConfig file
root = true

# Common settings
[*]
end_of_line = lf
indent_style = space
indent_size = 4
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

# Git configuration files uses tabs as indentation units
[.git*]
indent_style = tab

# Avoid git patch fail to apply due to stripped unmodified lines that contains only spaces
[/.git/**]
trim_trailing_whitespace = false

# Makefiles for *Make
[{Makefile,*.mk}]
indent_style = tab

# Markdown documents
[*.{md,mkd,mkdn,markdown}]
# Trailing whitespace means manual linebreaks
trim_trailing_whitespace = false

# Don't check indentation size as it can't handle intentional indentation
# in list item after hardbreaks to align with the node markers, use
# Markdownlint to check instead
indent_size = unset

[*.{diff,patch}]
# Trailing whitespaces are unchanged lines in patch files
trim_trailing_whitespace = false

# Vagrant configuration file
[Vagrantfile]
indent_size = 2

# yamllint configuration files
[.yamllint]
indent_size = 2

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

[.*.{yml,yaml}]
indent_size = 2
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Git path attributes configuration file
#
# References:
#
# * Git - Git Attributes
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
# * 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

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

# Keep editorconfig for ease of editing of product files
/.editorconfig -export-ignore

# Keep REUSE DEP5 declaration file in the release archive for legal
# conformance
/.reuse/ -export-ignore
/.reuse/* export-ignore
/.reuse/dep5 -export-ignore
10 changes: 10 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# workflows

Workflow definition files of the [GitHub Actions Continuous Integration(CI) service](https://github.com/features/actions)

## Reference

* [Features • GitHub Actions](https://github.com/features/actions)
Product page
* [GitHub Actions Documentation - GitHub Docs](https://docs.github.com/en/actions)
Official documentation
63 changes: 63 additions & 0 deletions .github/workflows/check-potential-problems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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: Check potential problems in the project
on:
push:
branches:
- '**'
jobs:
check-using-precommit:
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: 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
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
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
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
- name: Send CI result notification to the Telegram channel
uses: yanzay/notify-telegram@v0.1.0
if: always()
with:
chat: '@the_common_ci_results'
token: ${{ secrets.telegram_bot_api_token_ci }}
status: ${{ job.status }}
90 changes: 90 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Version Tracking Ignore Rules for Git VCS
# https://git-scm.com/docs/gitignore
#
# Exclude files not suitable for version tracking in Git
#
# 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>
# SPDX-License-Identifier: CC-BY-SA-4.0

# Don't track regular Unix hidden files
.*

# Do track Git configuration files
!.git*

# Do track EditorConfig configuration files
# https://editorconfig.org/
!.editorconfig

# Do track pre-commit configuration files
# https://pre-commit.com/
!.pre-commit-config.yaml

# Do track Markdownlint configuration files
# https://github.com/DavidAnson/markdownlint
!.markdownlint.*

# Do track Drone CI configuration files
# https://docs.drone.io/
!.drone.yml

# Do track yamllint configuration files
!.yamllint

# Do track REUSE configuration files
# https://reuse.software/
!.reuse/

# Do track GitLab CI configuration file
!/.gitlab-ci.yml

# Don't track common backup filename extensions
*~
*.bak*
*.backup*
*.bk*
*.old*
*.orig*

## Don't track common archive files
*.7z
*.bz2
*.gz
*.tar*
*.xz
*.zip

# Don't track binary image files
*.bmp
*.jpg
*.png

# Don't track common export formats from Markdown
*.doc?
*.htm?
*.pdf

# Don't track common program output logs
*.err
*.error
*.log
*.out
*.output

# Don't track compiled Python code caches
*.pyc

# Don't track Vagrant runtime directories
.vagrant/

# Don't track GNU gettext message catalog template
*.pot

# Don't track GNU gettext machine-readable message catalogs
*.mo

# Don't track continuous integration virtual environments
/continuous-integration/venv/
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Git submodule definition file
#
# Reference:
#
# * Git - gitmodules Documentation
# https://git-scm.com/docs/gitmodules
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
44 changes: 44 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0

# Inherit Markdownlint rules
default: True

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

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

# Only allow 2 spaces as linebreak sequence
MD009:
br_spaces: 2

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

# Allow missing padding blank line between the heading markup and the context
MD022: False

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

# Allow missing padding blank line between a list and its context
MD032: False

# Allow using raw HTML markups as workarounds of deficiencies of Markdown
MD033: False

# Allow using YAML front matter, while not require the definition of the
# `title` property
MD041:
front_matter_title: '.*'
63 changes: 63 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Pre-commit framework Configuration
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
#
# 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>
# SPDX-License-Identifier: CC-BY-SA-4.0

repos:
# Some out-of-the-box hooks for pre-commit
# https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-vcs-permalinks
- id: check-yaml
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md

# Check Markdown documents with Markdownlint(Node.js variant)
# https://github.com/DavidAnson/markdownlint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.23.2
hooks:
- id: markdownlint

# Check REUSE compliance
# https://reuse.software/
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
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
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Redirector site for https://brlin.me
Upstream-Contact: Issues · Lin-Buo-Ren/Lin-Buo-Ren.github.io <https://github.com/Lin-Buo-Ren/Lin-Buo-Ren.github.io/-/issues>
Source: https://github.com/Lin-Buo-Ren/Lin-Buo-Ren.github.io

Files:
*README.md
*/README.md
Copyright: 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
License: CC-BY-SA-4.0+
Loading

0 comments on commit 52c94a6

Please sign in to comment.