feat: 新增 20240509_Git版控起手式 教材

This commit is contained in:
SRC0730 2024-05-08 16:07:36 +08:00
commit 4bba16d202
12 changed files with 182 additions and 0 deletions

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# Tutorial Document
此專案主要為教育訓練使用
## Report
- [20240509_Git版控起手式](release/20240509_Git版控起手式.pdf)
## 參考 Repo
- [Tutorial_Git-UploadOldProject](http://twvoadtpw100004/OAD-WebTeam/Tutorial_Git-UploadOldProject)

BIN
doc_image/Git.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
doc_image/GitFlow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
doc_image/GitHubFlow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
doc_image/Gitea.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
doc_image/Sourcetree.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
doc_image/Sourcetree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
doc_image/VisualStudio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

View File

@ -0,0 +1,171 @@
---
marp: true
theme: uncover
paginate: true
headingDivider: 3
header: 20240509_Git版控起手式
footer: OAD-WebTeam / Dave Mark
style: |
header {
text-align: left;
}
footer {
text-right: right;
}
ul li {
margin: 10px 0;
}
table {
font-size: 25px;
width:100%;
}
table img {
margin: 10px 0;
height: 150px;
}
th:not(:first-child):not(:last-child),
td:not(:first-child):not(:last-child) {
border-left: 1px solid #999;
border-right: 1px solid #999;
}
h3 {
text-align: left;
}
section.content ul {
margin-left: 0;
font-size: 30px;
}
---
# Git版控起手式
<!-- _paginate: skip -->
> OAD-WebTeam / Dave Mark
## 議程
- Git & Gitea 版控
- CI/CD 自動佈署
- 參考資料
## Git & Gitea 版控
## ![Git](../doc_image/Git.png)
> [https://git-scm.com/](https://git-scm.com/)
### **Git** vs **SVN**
| | Git | SVN |
| ---------------- | ----------------------------------- | -------------------------------------- |
| **管理概念** | 分散式(distributed)<br/>強調個體 | 集中式(centralized)<br/>中央伺服器儲存 |
| **效能** | fast<br/>local commit push server | slow<br/>commit to server |
| **離線工作** | ⭕ | ❌ |
| **分支掌控度** | high<br/>清楚知道Merge版本歷程 | low<br/>無法分辨Merge版本 |
| **適用多人開發** | 較適合(搭配Flow) | 較困難 |
| **系統檔案** | 根目錄.git folder & .gitignore File | 每層目錄放.svn folder |
| **權限** | 使用帳號角色劃分 | 針對目錄做存取權限 |
### Git Commit Message
<!-- _class: content -->
- feat新增或修改功能
- fix修補 bug
- docs文件
- style格式
- refactor重構
- perf改善效能
- test增加測試
- choremaintain
- revert撤銷回覆先前的 commit
### Tools
| Sourcetree | Visual Studio Code | Visual Studio |
| ------------------------------------------ | -------------------------------------------------------- | ----------------------------------------------- |
| ![Sourcetree](../doc_image/Sourcetree.png) | ![Visual Studio Code](../doc_image/VisualStudioCode.png) | ![Visual Studio](../doc_image/VisualStudio.png) |
## ![Sourcetree](../doc_image/Sourcetree.png)<br/>SourceTree
![bg right](../doc_image/SourcetreeLayout.png)
> [https://www.sourcetreeapp.com/](https://www.sourcetreeapp.com/)
## ![Gitea](../doc_image/Gitea.png)
> [https://about.gitea.com/](https://about.gitea.com/)
### Gitea
<!--_class: content -->
- 跨平台:使用 **Go** 語言開發,可在 Windows、macOS、Linux 執行。
- 安裝:
- Windows 搭配 Windows 服務
- Docker image 建置 Linux 服務
- 運作方式:比照 GitHub 方式以個人與組織方式運作,各 Repo 存取權限依照定義的帳號**角色**呈現。
- CI/CD搭配 **Gitea Action** 實作
### **Git Flow** vs **Github Flow** vs **GitLab Flow** ?
### Git Flow
![Git Flow](../doc_image/GitFlow.png)
### GitHub Flow
![GitHub Flow](../doc_image/GitHubFlow.png)
## 實戰演練 Demo
> [Tutorial_Git-UploadOldProject](http://twvoadtpw100004/OAD-WebTeam/Tutorial_Git-UploadOldProject)
## CI/CD 自動佈署
### 什麼是 CI/CD ?
<!-- _class: content -->
- 持續整合(Continuous Integration, CI)
- 建置:確保提交的程式碼是否可執行
- 測試:確保功能正常與軟體品質
- 程式碼分析:檢查 code style 或程式的穩健度
- 持續交付/佈署(Continuous Delivery / Deployment, CD)
- 持續交付:自動將生產已就緒版本發佈到代碼存儲庫
- 持續佈署:可以自動將應用發佈到生產環境
### CI/CD 準備工作
<!-- _class: content -->
- 持續整合(Continuous Integration, CI)
1. 專案以純 Source Code 為主
2. 流程是否已可使用 command 處理?
3. 建置環境是否備妥? SDK?
- 持續交付/佈署(Continuous Delivery / Deployment, CD)
1. 流程是否已使用 command 處理?
2. 目的與 Gitea Server Protocol 是否互通? 認證機制?
### Gitea workflow
<!-- _class: content -->
- Gitea 專案開啟 `Actions` 功能
- 專案內建置 `.gitea/workflow/{腳本名稱}.yml`
- 觸發條件為何? `push branch develop` or `push branch release`?
- 工作事項簡單區分 build(CI) 及 deploy(CD) job
- 撰寫 command 腳本 (ex. Command Prompt、Windows PowerShell)
- 設計 Secrets 參數 (ex. 主機資訊、認證)
- Action Runner 工作事項
## 實戰演練 Demo
## 參考資料
- [Gitbook](https://gitbook.tw/)
- [Git Commit](https://heidiliu2020.github.io/git-commit-message/)
- [Git Flow](https://gitbook.tw/chapters/gitflow/why-need-git-flow)