Skip to content

Commit

Permalink
update with cicd #patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jagar2 committed Dec 9, 2024
1 parent ebd1313 commit 024e7e2
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 8 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI/CD

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: shenron
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyscaffold
pip install tox
- name: Run tests and build docs
run: |
tox
tox -e docs
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: ./docs/_build/html

deploy_docs:
runs-on: shenron
needs: build
if: github.ref == 'refs/heads/main'
env:
HOME: "${{ github.workspace }}/../" # Because self-hosted runner is root
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs
path: artifacts

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./artifacts

version_bump:
runs-on: shenron
needs: build
if: |
contains(github.event.head_commit.message, '#patch') ||
contains(github.event.head_commit.message, '#minor') ||
contains(github.event.head_commit.message, '#major')
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Bump version and push tag
uses: anothrNick/github-tag-action@v1
env:
DEFAULT_BUMP: patch
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
RELEASE_BRANCHES: main

publish:
runs-on: shenron
needs: [build, version_bump]
if: |
contains(github.event.head_commit.message, '#patch') ||
contains(github.event.head_commit.message, '#minor') ||
contains(github.event.head_commit.message, '#major')
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install --upgrade twine
twine upload dist/*
28 changes: 28 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, M3-Learning: Multifunctional Materials and Machine Learning

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added docs/_static/Drexel_blue_Logo_square_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/Drexel_blue_Logo_square_Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
171 changes: 171 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*******************************************************************************
* light theme
*
* all the variables used for light theme coloring
*/
html[data-theme="light"] {
/*****************************************************************************
* main colors
*/
--pst-color-primary: #002d72;
/* PMS 294C (Drexel Blue) */
--pst-color-secondary: #ffd100;
/* PMS 7548C (Drexel Yellow) */
--pst-color-success: #9dad33;
/* PMS 583C (Light Green) */
--pst-color-info: #006298;
/* PMS 7691C (Dark Blue) */
--pst-color-warning: #ff8f1c;
/* PMS 1495C (Light Orange) */
--pst-color-danger: #a50021;
/* PMS 7427C (Red) */
--pst-color-text-base: #002d72;
/* PMS 294C (Drexel Blue) */
--pst-color-text-muted: #a7a8aa;
/* Cool Gray 6C */
--pst-color-border: #d1d5d8;
/* PMS 427C (Very Light Gray) */
--pst-color-shadow: #a7a8aa;
/* Cool Gray 6C */

/*****************************************************************************
* depth colors
*
* background: the more in depth color
* on-background: the object directly set on the background, use of shadows in light theme
* surface: object set on the background (without shadows)
* on_surface: object set on surface object (without shadows)
*/
--pst-color-background: #ffffff;
/* White */
--pst-color-on-background: #f5f5f5;
/* Light Gray */
--pst-color-surface: #f0f0f0;
/* Very Light Gray */
--pst-color-on-surface: #ededed;
/* Lighter Gray */

/*****************************************************************************
* extentions
*/

--pst-color-panel-background: var(--pst-color-background);

/*****************************************************************************
* layout
*/

/* links */
--pst-color-link: var(--pst-color-primary);
--pst-color-link-hover: var(--pst-color-secondary);

/* inline code */
--pst-color-inline-code: #d64309;
/* PMS 7597C (Light Red) */

/* targeted content */
--pst-color-target: #c4d600;
/* PMS 384C (Green) */

/* hide any content that should not be displayed in the light theme */
.only-dark {
display: none !important;
}
}

/*******************************************************************************
* dark theme
*
* all the variables used for dark theme coloring
*/
html[data-theme="dark"] {
/*****************************************************************************
* main colors
*/
--pst-color-primary: #ffd100;
/* PMS 7548C (Drexel Yellow) */
--pst-color-secondary: #002d72;
/* PMS 294C (Drexel Blue) */
--pst-color-success: #6cace4;
/* PMS 284C (Light Blue) */
--pst-color-info: #c7e1d2;
/* PMS 5665C (Very Light Green) */
--pst-color-warning: #d86018;
/* PMS 138C (Orange) */
--pst-color-danger: #a50021;
/* PMS 7427C (Red) */
--pst-color-text-base: #ffffff;
/* PMS 7548C (Drexel Yellow) */
--pst-color-text-muted: #bcb4a5;
/* Warm Gray 3C */
--pst-color-border: #a7a8aa;
/* Cool Gray 6C */
--pst-color-shadow: var(--pst-color-background);

/*****************************************************************************
* depth colors
*
* background: the more in depth color
* on-background: the object directly set on the background, use of a light grey in dark theme
* surface: object set on the background (without shadows)
* on_surface: object set on surface object (without shadows)
*/
--pst-color-background: #001d48;
/* PMS 294C (Drexel Blue) */
--pst-color-on-background: #001d48;
/* PMS 294C (Drexel Blue) */
--pst-color-surface: #006298;
/* PMS 7691C (Dark Blue) */
--pst-color-on-surface: #006298;
/* PMS 7691C (Dark Blue) */

/*****************************************************************************
* extentions
*/

--pst-color-panel-background: var(--pst-color-background);

/*****************************************************************************
* layout
*/

/* links */
--pst-color-link: var(--pst-color-primary);
--pst-color-link-hover: var(--pst-color-secondary);

/* inline code */
--pst-color-inline-code: #d86018;
/* PMS 138C (Orange) */

/* targeted content */
--pst-color-target: #ff8f1c;
/* PMS 1495C (Light Orange) */

/* hide any content that should not be displayed in the dark theme */
.only-light {
display: none !important;
}

/* specific brightness applied on images */
img {
filter: brightness(0.8) contrast(1.2);
}
}

/* custom.css */

.light-mode .logo-light {
display: block;
}

.light-mode .logo-dark {
display: none;
}

.dark-mode .logo-light {
display: none;
}

.dark-mode .logo-dark {
display: block;
}
34 changes: 26 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# serve to show the default.

import os
import sys
import shutil
import sys

# -- Path setup --------------------------------------------------------------

Expand All @@ -34,7 +34,7 @@
from sphinx import apidoc

output_dir = os.path.join(__location__, "api")
module_dir = os.path.join(__location__, "../src/pykubegrader")
module_dir = os.path.join(__location__, "../src/PyKubeGrader")
try:
shutil.rmtree(output_dir)
except FileNotFoundError:
Expand Down Expand Up @@ -72,13 +72,15 @@
"sphinx.ext.ifconfig",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"nbsphinx",
"myst_nb",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = ".rst"
source_suffix = [".rst", ".md", ".ipynb"]

# The encoding of source files.
# source_encoding = 'utf-8-sig'
Expand All @@ -99,7 +101,7 @@
# If you don’t need the separation provided between version and release,
# just set them both to the same value.
try:
from pykubegrader import __version__ as version
from PyKubeGrader import __version__ as version
except ImportError:
version = ""

Expand Down Expand Up @@ -153,14 +155,26 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "alabaster"
html_theme = "pydata_sphinx_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# Material theme options (see theme.conf for more information)
html_theme_options = {
"sidebar_width": "300px",
"page_width": "1200px"
"show_nav_level": 4,
"icon_links": [
{
"name": "GitHub",
"url": "m3-learning/PyKubeGrader",
"icon": "fab fa-github-square",
"type": "fontawesome",
}
],
"logo": {
"image_light": "_static/Drexel_blue_Logo_square_Light.png",
"image_dark": "_static/Drexel_blue_Logo_square_Dark.png",
},
}

# Add any paths that contain custom themes here, relative to this directory.
Expand All @@ -187,9 +201,13 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_css_files = [
"custom.css",
]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
Expand Down

0 comments on commit 024e7e2

Please sign in to comment.