-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
386a501
commit ebed9d0
Showing
5 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
|
||
documents: | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [ '3.11' ] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip build | ||
python -m pip install -r requirements/docs.txt | ||
- name: Deploy documents | ||
run: | | ||
git config user.name ${{ github.repository_owner }} | ||
git config user.email "${{ secrets.GH_EMAIL }}" | ||
git remote add gh-token "https://${{ secrets.PAT }}@github.com/ibrahimroshdy/continuous_integration.git" | ||
git fetch gh-token && git fetch gh-token gh-pages:gh-pages | ||
python -m mkdocs gh-deploy -v --clean --remote-name gh-token | ||
git push gh-token gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Continuous Integration | ||
![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) | ||
[![Continuous Integration](https://github.com/ibrahimroshdy/continuous_integration/actions/workflows/ci_workflow.yml/badge.svg?branch=main)](https://github.com/ibrahimroshdy/continuous_integration/actions/workflows/ci_workflow.yml) | ||
[![codecov](https://codecov.io/gh/ibrahimroshdy/continuous_integration/branch/main/graph/badge.svg?token=Y56VABDZA7)](https://codecov.io/gh/ibrahimroshdy/continuous_integration) | ||
|
||
## About | ||
A sample project of adding continuous integration | ||
to GitHub and utilising the GitHub actions, workflows and job settings. | ||
This project contains a `simple_loop.py` python file that prints a progress bar of a for loop. | ||
The aim of this project to serve a sample project for implementing GitHub's | ||
workflow using workflow files, and custom actions and multiple jobs. | ||
|
||
### Folder Stucture | ||
``` | ||
continuous_integration | ||
│ | ||
├── README.md | ||
├── .github # gitHub workflow directory | ||
│ ├── actions # Custom actions directory | ||
│ │ └── install-run-code # This project's Custom Action to be referred to by name in workflows | ||
│ │ └── action.yml # Action instructions file [Must be named action] | ||
│ └── workflows # This project's Workflows | ||
│ └── ci_workflow.yml # Workflow instructions file | ||
├── .gitignore | ||
├── pyproject.toml | ||
└── simple_loop.py | ||
``` | ||
|
||
|
||
### Getting Started | ||
|
||
There is no need to run the project locally, but in case it is needed here is the quick start instructions used. | ||
Note: Those are the same instructions in `.github/workflows/ci_workflows.yml` and `.github/actions/install-run-code/actions.yml` | ||
|
||
Project is also setup for a Docker Multi-arch build for `arm64` and `amd64`. Read more about it in this [article](https://ibrahimroshdy.medium.com/how-to-build-your-docker-images-using-multi-arch-to-support-arm64-m1-macbook-6ebc42a47cd7). | ||
|
||
Create a virtualenv | ||
```bash | ||
virtualenv venv -p python3 | ||
``` | ||
|
||
Activate your venv | ||
```bash | ||
source venv/bin/activate | ||
``` | ||
|
||
Install poetry and pyfiglet using pip | ||
```bash | ||
pip install poetry pyfiglet | ||
``` | ||
|
||
Run poetry install to install all needed python packages | ||
```bash | ||
poetry install | ||
``` | ||
|
||
Run pyfiglet because you can | ||
```bash | ||
pyfiglet Continuous Integration | ||
``` | ||
|
||
Finally, run code | ||
```bash | ||
python simple_loop.py | ||
``` | ||
|
||
You should have something like that: | ||
|
||
```bash | ||
This is a progress bar of the simple loop script | ||
100%|███████| 1000000/1000000 [00:00<00:00, 4474649.76it/s] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# mkdocs.yml - WitnessAI Documentation Configuration | ||
|
||
# Site Information | ||
site_name: Continuous Integration | ||
site_description: Continuous Integration with Github Actions and Docker Multi-Arch Buildx for amd64 and arm64. | ||
site_author: ibrahimroshdy | ||
|
||
# Copyright Information | ||
copyright: Copyright © 2024 Ibrahim Roshdy | ||
|
||
# Repository Information | ||
repo_url: https://github.com/ibrahimroshdy/continuous_integration | ||
repo_name: ir/continuous_integration | ||
|
||
# Edit Button Configuration | ||
edit_uri: "" | ||
|
||
# Plugins Configuration | ||
plugins: | ||
- search | ||
- mkdocstrings: | ||
handlers: | ||
python: | ||
import: | ||
- https://docs.python.org/3/objects.inv | ||
- https://installer.readthedocs.io/en/stable/objects.inv # demonstration purpose in the docs | ||
- https://mkdocstrings.github.io/autorefs/objects.inv | ||
- https://docs.celeryproject.org/en/stable/objects.inv | ||
paths: [ src ] | ||
options: | ||
# docstring_style: google | ||
docstring_options: | ||
ignore_init_summary: true | ||
# docstring_section_style: list | ||
filters: [ "!^_" ] | ||
heading_level: 4 | ||
inherited_members: true | ||
merge_init_into_class: true | ||
separate_signature: true | ||
show_root_heading: true | ||
show_root_full_path: true | ||
show_signature_annotations: true | ||
show_symbol_type_heading: true | ||
show_symbol_type_toc: true | ||
signature_crossrefs: true | ||
summary: true | ||
|
||
# Theme Configuration | ||
theme: | ||
name: material | ||
# logo: logo.png | ||
# favicon: logo.png | ||
icon: | ||
repo: fontawesome/brands/github | ||
features: | ||
- announce.dismiss | ||
- content.action.edit | ||
- content.action.view | ||
- content.code.annotate | ||
- content.code.copy | ||
# - content.code.select | ||
# - content.tabs.link | ||
- content.tooltips | ||
# - header.autohide | ||
# - navigation.expand | ||
- navigation.footer | ||
- navigation.indexes | ||
# - navigation.instant | ||
# - navigation.instant.prefetch | ||
# - navigation.instant.progress | ||
# - navigation.prune | ||
- navigation.sections | ||
# - navigation.tabs | ||
# - navigation.tabs.sticky | ||
# - navigation.top | ||
- navigation.tracking | ||
- search.highlight | ||
- search.share | ||
- search.suggest | ||
- toc.follow | ||
# - toc.integrate | ||
palette: | ||
- media: "(prefers-color-scheme)" | ||
toggle: | ||
icon: material/brightness-auto | ||
name: Switch to light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: default | ||
primary: green | ||
accent: black | ||
toggle: | ||
icon: material/weather-sunny | ||
name: Switch to dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
scheme: slate | ||
primary: green | ||
accent: black | ||
toggle: | ||
icon: material/weather-night | ||
name: Switch to system preference | ||
|
||
|
||
# Navigation Configuration | ||
nav: | ||
- Index: index.md | ||
|
||
|
||
# Markdown Extensions | ||
markdown_extensions: | ||
- abbr | ||
- admonition | ||
- attr_list | ||
- def_list | ||
- footnotes | ||
- md_in_html | ||
- toc: | ||
permalink: true | ||
separator: "_" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters