Skip to content

Commit

Permalink
refactor: 引入 1.5.5 版的主題範本配置(持續整合與交付支援)
Browse files Browse the repository at this point in the history
Signed-off-by: 林博仁(Buo-ren, Lin) <[email protected]>
  • Loading branch information
brlin-tw committed Nov 15, 2023
1 parent 049f73f commit ac96682
Show file tree
Hide file tree
Showing 17 changed files with 1,050 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ trim_trailing_whitespace = false
# 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
Expand All @@ -52,3 +56,6 @@ indent_size = 2
# YAML documents
[*.{yml,yaml}]
indent_size = 2

[.*.{yml,yaml}]
indent_size = 2
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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) <[email protected]>
# 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
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

放置 [GitHub Actions](https://github.com/features/actions) 的工作流程(workflow)定義檔

## 參考資料<br>Reference

* [Features • GitHub Actions](https://github.com/features/actions)
Product page
* [GitHub Actions Documentation - GitHub Docs](https://docs.github.com/en/actions)
Official documentation
48 changes: 48 additions & 0 deletions .github/workflows/check-potential-problems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 用來檢查專案中的潛在問題的 GitHub Actions 工作流程(workflow)定義檔
#
# 編輯參考:
#
# * 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) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: 檢查專案中的潛在問題
on:
- push
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
steps:
- name: 自版控庫取出內容
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: Running static analysis program
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/[email protected]
if: always()
with:
chat: '@libre_knowledge_ci'
token: ${{ secrets.telegram_bot_api_token_ci }}
status: ${{ job.status }}
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Release product and their build aritfacts
#
# References:
#
# * 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) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: Release product and their build aritfacts
on:
push:
tags:
- v*.*.*

jobs:
release:
name: Release product and their build aritfacts
runs-on: ubuntu-20.04
steps:
- name: Checkout content from the Git repository
uses: actions/checkout@v4

- name: Determine the project identifier
run: printf "project_id=${GITHUB_REPOSITORY##*/}\\n" >> $GITHUB_ENV

- name: Determine the name of the Git tag
run: printf "release_tag=${GITHUB_REF##*/}\\n" >> $GITHUB_ENV

- name: Determine the release version string
run: printf "release_version=${release_tag#v}\\n" >> $GITHUB_ENV

- name: Determine the release identifier
run: printf "release_id=${project_id}-${release_version}\\n" >> $GITHUB_ENV

- name: Generate the release archive
run: |-
sudo ./continuous-integration/generate-build-artifacts.install-system-deps.sh
./continuous-integration/generate-build-artifacts.sh
- name: Generate the release description
run: ./continuous-integration/generate-release-description.sh

- name: Publish the release archive to the GitHub Releases
uses: softprops/[email protected]
with:
name: ${{ env.project_id }} ${{ env.release_version }}
files: |
${{ env.release_id }}.tar*
body_path: .detailed_changes
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) <[email protected]>
# 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 intregration virtual environments
/continuous-integration/venv/
64 changes: 64 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# GitLab CI configuration file
#
# References:
#
# * `.gitlab-ci.yml` keyword reference | GitLab
# https://docs.gitlab.com/ee/ci/yaml/
#
# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]>
# SPDX-License-Identifier: CC-BY-SA-4.0
do-static-analysis:
stage: test
rules:
- if: $CI_COMMIT_TAG == null
needs: []
image: ubuntu:22.04
variables:
PIP_CACHE_DIR: ${CI_PROJECT_DIR}/.cache/pip
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
# Enable per-job and per-branch caching
key: $CI_JOB_NAME-$CI_COMMIT_REF_SLUG
paths:
- ${PIP_CACHE_DIR}
- ${PRE_COMMIT_HOME}

script:
- ./continuous-integration/do-static-analysis.install-system-deps.sh
- ./continuous-integration/do-static-analysis.sh

generate-build-artifacts:
stage: build
rules:
- if: $CI_COMMIT_TAG
needs: []
image: ubuntu:22.04
artifacts:
paths:
- ${CI_PROJECT_NAME}-*.tar*
script:
- ./continuous-integration/generate-build-artifacts.install-system-deps.sh
- ./continuous-integration/generate-build-artifacts.sh

upload-release-assets:
stage: deploy
rules:
- if: $CI_COMMIT_TAG
needs:
- generate-build-artifacts
image: curlimages/curl:latest
script:
- ./continuous-integration/upload-gitlab-generic-packages.sh

create-release:
stage: deploy
rules:
- if: $CI_COMMIT_TAG
needs:
- generate-build-artifacts
- upload-release-assets
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- apk add bash git
- ./continuous-integration/generate-release-description.sh
- ./continuous-integration/create-gitlab-release.sh
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ repos:
# Check REUSE compliance
# https://reuse.software/
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
rev: v1.0.0
hooks:
- id: reuse

# Check YAML files
# https://github.com/adrienverge/yamllint
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.1
rev: v1.30.0
hooks:
- id: yamllint
8 changes: 4 additions & 4 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: 《自由知識協作平台》主題範本
Upstream-Contact: Issues · libre-knowledge/subject-template <https://github.com/libre-knowledge/subject-template/issues>
Source: https://github.com/libre-knowledge/subject-template
Upstream-Name: 《自由知識協作平台》「虛擬化」主題
Upstream-Contact: 議題 · 自由知識協作平台 Libre Knowledge Collaboration Platform / 虛擬化 Virtualization · GitLab <https://gitlab.com/libre-knowledge/virtualization/-/issues>
Source: https://gitlab.com/libre-knowledge/virtualization

Files:
*README.md
*/README.md
_config.yml
Copyright: 2022 自由知識協作平台貢獻者 <https://github.com/libre-knowledge/libre-knowledge/issues>
Copyright: 2023 自由知識協作平台貢獻者 <https://gitlab.com/libre-knowledge/libre-knowledge/-/issues>
License: CC-BY-SA-4.0
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

將一個或多個實體資源,如硬體、作業系統、應用程式或資料儲存,透過軟體技術的手段,將其抽象化、隔離化、統合化及自動化,形成一個或多個虛擬的資源,讓使用者可以彈性地使用和管理這些虛擬化的資源,並且可以在不影響其他虛擬化資源的情況下進行管理和配置

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white "本專案使用 pre-commit 檢查專案中的潛在問題")](https://github.com/pre-commit/pre-commit) [![REUSE 規範遵從狀態標章](https://api.reuse.software/badge/gitlab.com/libre-knowledge/virtualization "本專案遵從 REUSE 規範降低軟體授權合規成本")](https://api.reuse.software/info/github.com/libre-knowledge/virtualization)
<https://gitlab.com/libre-knowledge/virtualization>
[![GitLab CI 持續整合流程狀態標章](https://gitlab.com/libre-knowledge/virtualization/badges/main/pipeline.svg?ignore_skipped=true "點擊查看 GitLab CI 持續整合流程的運行狀態")](https://gitlab.com/libre-knowledge/virtualization/-/commits/main) [![「檢查專案中的潛在問題」GitHub Actions 作業流程狀態標章](https://github.com/libre-knowledge/virtualization/actions/workflows/check-potential-problems.yml/badge.svg "本專案使用 GitHub Actions 自動化檢查專案中的潛在問題")](https://github.com/libre-knowledge/virtualization/actions/workflows/check-potential-problems.yml) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white "本專案使用 pre-commit 檢查專案中的潛在問題")](https://github.com/pre-commit/pre-commit) [![REUSE 規範遵從狀態標章](https://api.reuse.software/badge/github.com/libre-knowledge/virtualization "本專案遵從 REUSE 規範降低軟體授權合規成本")](https://api.reuse.software/info/github.com/libre-knowledge/virtualization)

## 基本概念

Expand Down
Loading

0 comments on commit ac96682

Please sign in to comment.