Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.2.2] Docs Update #63

Merged
merged 9 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/pr-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,27 @@ jobs:
});
}

// Check for PR from docs to dev*
if (baseBranch.startsWith('dev') && headBranch === 'docs') {
// Check for PR from docs-* to master
if (baseBranch === 'master' && headBranch.startsWith('docs-')) {
const files = await github.rest.pulls.listFiles({
owner,
repo,
pull_number: issueNumber
});

files.data.forEach(file => {
labelsToAdd.push('release/docs');
if (file.filename.startsWith('Jenkins') || file.filename.startsWith('.github/workflows')) {
labelsToAdd.push('chore');
}
if (file.filename.startsWith('docs')) {
labelsToAdd.push('docs');
}
});
}

// Check for PR from docs to dev* or docs*
if ((baseBranch.startsWith('dev') || baseBranch.startsWith('docs')) && headBranch === 'docs') {
labelsToAdd.push('docs');
}

Expand Down
43 changes: 33 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ spec:
}
}
}
// [`*` Push] "Merge pull request*/docs"
stage("Merge From Docs") {
when {
expression {
return commitMessage.startsWith("Merge pull request") && commitMessage.contains("/docs")
return commitMessage.startsWith("Merge pull request") && commitMessage.endsWith("[Docs] Build by Sphinx for GitHub Pages")
}
}
steps {
Expand All @@ -74,13 +75,15 @@ spec:
}
}
}
// [`dev*` Push]
// [`master` PR] (Except "Merge pull request*/docs")
stage("1. Lint") {
when {
anyOf {
branch pattern: "dev.*", comparator: "REGEXP"
expression {
def isMasterPR = env.CHANGE_TARGET == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.endsWith("[Docs] Build by Sphinx for GitHub Pages")
return isMasterPR && isNotDocsMerge
}
}
Expand All @@ -105,14 +108,21 @@ spec:
}
}
}
// [`master` Push] (Except "Merge pull request*/docs*")
// [`dev*` Push]
// [`master` PR] (Except "Merge pull request*/docs")
stage("2. Build") {
when {
anyOf {
branch "master"
expression {
def isMasterBranch = env.BRANCH_NAME == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
return isMasterBranch && isNotDocsMerge
}
branch pattern: "dev.*", comparator: "REGEXP"
expression {
def isMasterPR = env.CHANGE_TARGET == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.endsWith("[Docs] Build by Sphinx for GitHub Pages")
return isMasterPR && isNotDocsMerge
}
}
Expand All @@ -139,13 +149,15 @@ spec:
}
}
}
// [`dev*` Push]
// [`master` PR] (Except "Merge pull request*/docs")
stage("3. Test") {
when {
anyOf {
branch pattern: "dev.*", comparator: "REGEXP"
expression {
def isMasterPR = env.CHANGE_TARGET == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.endsWith("[Docs] Build by Sphinx for GitHub Pages")
return isMasterPR && isNotDocsMerge
}
}
Expand All @@ -170,11 +182,12 @@ spec:
}
}
}
// [`master` PR] (Except "Merge pull request*/docs")
stage("4. Docs") {
when {
expression {
def isMasterPR = env.CHANGE_TARGET == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.endsWith("[Docs] Build by Sphinx for GitHub Pages")
return isMasterPR && isNotDocsMerge
}
}
Expand All @@ -183,8 +196,13 @@ spec:
try {
def startTime = System.currentTimeMillis()
setBuildStatus("Build...", "PENDING", "$STAGE_NAME")
def version = env.CHANGE_BRANCH.replace("dev-", "")
sh "sed -i 's/^__version__ = .*/__version__ = \"'${version}'\"/' zerohertzLib/__init__.py"
if (env.CHANGE_BRANCH.startsWith("dev-")) {
sh "sed -i 's/^__version__ = .*/__version__ = \"'${env.CHANGE_BRANCH.replace('dev-', '')}'\"/' zerohertzLib/__init__.py"
} else if (env.CHANGE_BRANCH.startsWith("docs-")) {
echo "No action required for docs- branch"
} else {
error "Unsupported branch type: ${env.CHANGE_BRANCH}"
}
withCredentials([usernamePassword(credentialsId: "GitHub", usernameVariable: "GIT_USERNAME", passwordVariable: "GIT_PASSWORD")]) {
sh '''
git config --global user.email "[email protected]"
Expand All @@ -208,7 +226,7 @@ spec:
container("python") {
sh "apt update"
sh "apt install build-essential -y"
sh "pip install sphinx furo sphinxcontrib-jquery sphinxcontrib-gtagjs sphinx-favicon sphinx-copybutton sphinx-paramlinks"
sh "pip install sphinx furo sphinxcontrib-jquery sphinxcontrib-gtagjs sphinx-favicon sphinx-copybutton sphinx-paramlinks myst-parser"
sh "cd sphinx && make html"
sh "rm -rf docs"
sh "mv sphinx/build/html docs"
Expand Down Expand Up @@ -251,9 +269,14 @@ spec:
}
}
}
// [`master` Push] (Except "Merge pull request*/docs*")
stage("Deploy") {
when {
branch "master"
expression {
def isMasterBranch = env.BRANCH_NAME == "master"
def isNotDocsMerge = !commitMessage.startsWith("Merge pull request") || !commitMessage.contains("/docs")
return isMasterBranch && isNotDocsMerge
}
}
steps {
script {
Expand Down
15 changes: 15 additions & 0 deletions docs/_sources/cicd.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CI/CD Pipelines

<p align="center">
<img width="1844" alt="CI/CD" src="https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/283340051-f8e81344-e662-4cac-9e8f-fb722997dbff.png">
</p>

|Stage|AS-IS|TO-BE|
|:-:|-|-|
|1. `Setup`|⭕ [`*` Push]|⭕ [`*` Push]|
|2. `Merge From Docs`|👎 [`*` Push] "Merge pull request\*/docs\*"|👍 [`*` Push] "Merge pull request\*/docs"|
|3. `1. Lint`|⭕ [`dev*` Push]<br>👎 [`master` PR] (Except "Merge pull request\*/docs\*")|⭕ [`dev*` Push]<br>👍 [`master` PR] (Except "Merge pull request\*/docs")|
|4. `2. Build`|👎 [`master` Push]</br>⭕ [`dev*` Push]<br>👎 [`master` PR] (Except "Merge pull request\*/docs\*")|👍 [`master` Push] (Except "Merge pull request\*/docs\*")</br>⭕ [`dev*` Push]<br>👍 [`master` PR] (Except "Merge pull request\*/docs")|
|5. `3. Test`|⭕ [`dev*` Push]<br>👎 [`master` PR] (Except "Merge pull request\*/docs\*")|⭕ [`dev*` Push]<br>👍 [`master` PR] (Except "Merge pull request\*/docs")|
|6. `4. Docs`|👎 [`master` PR] (Except "Merge pull request\*/docs\*")|👍 [`master` PR] (Except "Merge pull request\*/docs")|
|7. `Deploy`|👎 [`master` Push]|👍 [`master` Push] (Except "Merge pull request\*/docs\*")|
60 changes: 60 additions & 0 deletions docs/_sources/index.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<h2 align = "center">
⚡ Zerohertz's Library ⚡
</h2>

<p align="center">
</br>
<a href="https://github.com/Zerohertz/zerohertzLib">
<img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=GitHub&logoColor=white"/>
</a>
<a href="https://pypi.org/project/zerohertzLib/">
<img src="https://img.shields.io/badge/PyPI-3775A9?style=for-the-badge&logo=PyPI&logoColor=white"/>
</a>
<a href="https://jenkins.zerohertz.xyz/blue/organizations/jenkins/zerohertzLib/activity">
<img src="https://img.shields.io/badge/Jenkins-D24939?style=for-the-badge&logo=Jenkins&logoColor=white"/>
</a>
<a href = "https://zerohertz.github.io/python-pkg-cicd/">
<img src="https://img.shields.io/badge/Zerohertz's%20Blog-800a0a?style=for-the-badge&logo=beatsbydre&logoColor=white"/>
</a>
<a href="https://zerohertz.github.io/zerohertzLib/">
<img src="https://img.shields.io/badge/Sphinx-000000?style=for-the-badge&logo=Sphinx&logoColor=white"/>
</a>
</br>
<a href="https://pypi.org/project/zerohertzLib/">
<img src="https://badge.fury.io/py/zerohertzLib.svg" alt="PyPI version">
</a>
<a href="https://pypi.org/project/zerohertzLib/">
<img alt="PyPI wheel" src="https://img.shields.io/pypi/wheel/zerohertzLib">
</a>
<a href="https://app.codacy.com/gh/Zerohertz/zerohertzLib/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade">
<img src="https://app.codacy.com/project/badge/Grade/b08b1d140ee54ae1aa8ee251cb5888ff"/>
</a>
</p>

```bash
$ sudo apt install python3-opencv -y
$ pip install zerohertzLib
```

```python
import zerohertzLib as zz
```

```{eval-rst}
.. toctree::
:maxdepth: 2

zerohertzLib
release
cicd
```

<h3 align = "center">
📇 Index 📇
</h3>

```{eval-rst}
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
```
65 changes: 0 additions & 65 deletions docs/_sources/index.rst.txt

This file was deleted.

3 changes: 3 additions & 0 deletions docs/_sources/release.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release Notes

[To be continued...](https://github.com/Zerohertz/zerohertzLib/issues/62)
8 changes: 8 additions & 0 deletions docs/_sources/zerohertzLib.algorithm.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# zerohertzLib.algorithm

```{eval-rst}
.. automodule:: zerohertzLib.algorithm
:members:
:undoc-members:
:show-inheritance:
```
10 changes: 0 additions & 10 deletions docs/_sources/zerohertzLib.algorithm.rst.txt

This file was deleted.

8 changes: 8 additions & 0 deletions docs/_sources/zerohertzLib.api.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# zerohertzLib.api

```{eval-rst}
.. automodule:: zerohertzLib.api
:members:
:undoc-members:
:show-inheritance:
```
10 changes: 0 additions & 10 deletions docs/_sources/zerohertzLib.api.rst.txt

This file was deleted.

8 changes: 8 additions & 0 deletions docs/_sources/zerohertzLib.logging.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# zerohertzLib.logging

```{eval-rst}
.. automodule:: zerohertzLib.logging
:members:
:undoc-members:
:show-inheritance:
```
10 changes: 0 additions & 10 deletions docs/_sources/zerohertzLib.logging.rst.txt

This file was deleted.

16 changes: 16 additions & 0 deletions docs/_sources/zerohertzLib.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# zerohertzLib

```{eval-rst}
.. toctree::
:maxdepth: 2
:caption: Contents:

zerohertzLib.algorithm
zerohertzLib.api
zerohertzLib.logging
zerohertzLib.mlops
zerohertzLib.monitoring
zerohertzLib.plot
zerohertzLib.vision
```

8 changes: 8 additions & 0 deletions docs/_sources/zerohertzLib.mlops.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# zerohertzLib.mlops

```{eval-rst}
.. automodule:: zerohertzLib.mlops
:members:
:undoc-members:
:show-inheritance:
```
Loading