Skip to content

Commit

Permalink
Add docs and workflow for pusblish them
Browse files Browse the repository at this point in the history
  • Loading branch information
morenod authored and Docs committed Nov 24, 2023
1 parent cc8f2d6 commit fb1c7f5
Show file tree
Hide file tree
Showing 21 changed files with 464 additions and 124 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy docs
on:
workflow_call:
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Setup doc deploy
run: |
git config --global user.name Docs deploy
git config --global user.email docs@dummy.bot.com
- name: Install dependencies
run: pip install mkdocs-material mkdocs-include-markdown-plugin mike

- name: Deploy docs
run: mike deploy --push -m "Update docs to version ${{ github.ref_name }}" --update-aliases ${{ github.ref_name }} latest

- name: Set latest as default doc branch
run: mike set-default --push latest
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ on:
tags:
- "*" # triggers only if push new tag version
jobs:
release-build:
uses: ./.github/workflows/gorelease.yml

image-upload:
uses: ./.github/workflows/image-upload.yml
secrets: inherit

deploy-docs:
uses: ./.github/workflows/docs.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__/
**/__pycache__/
site/
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD013": false,
"MD007": {"indent": 4}
}
104 changes: 0 additions & 104 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
3 changes: 3 additions & 0 deletions docs/css/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.mermaid {
text-align: center;
}
13 changes: 13 additions & 0 deletions docs/development/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Continuous Integration Documentation

This documentation provides an overview of the different jobs and their execution in the CI workflow. The CI workflow consists of several jobs that automate various tasks such as linters, executing tests, generating and deploying documentation and creating releases. Each job is triggered based on specific events.

## Pull Request workflow
---

{% include-markdown "development/ci/pullrequest.md" %}

## Release workflow
---

{% include-markdown "development/ci/release.md" %}
80 changes: 80 additions & 0 deletions docs/development/ci/pullrequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
The pull Request Workflow, defined in the `pullrequest.yml` file, is triggered on `pull_request_target` events to the branches `master` and `main`. It has three jobs: **linters**, **build**, **tests**, and **report_results**.

```mermaid
graph LR
A[pull_request_target] --> B[linters] --> C[tests];
```

### Linters

This job performs the following steps:

1. Checks out the code
1. Installs pre-commit.
1. Runs pre-commit hooks to execute code linting based on `.pre-commit-config.yaml` file

#### Running local pre-commit

!!! info
Main purpose for pre-commit is to allow developers to pass the Lint Checks before commiting the code. Same checks will be executed on all the commits once they are pushed to GitHub

---

To install pre-commit checks locally, follow these steps:

1. Install [pre-commit](https://pre-commit.com/) by running the following command:

```console
pip install pre-commit
```

1. `ruby` is required for running the Markdown Linter, installation will depends on your Operating System, for example, on Fedora:

```console
dnf install -y ruby
```

1. Initialize pre-commit on the repo:

```console
pre-commit install
```

---

To run pre-commit manually for all files, you can use:

```console
$ pre-commit run --all-files
markdownlint.............................................................Passed
Test shell scripts with shellcheck.......................................Passed
check json...............................................................Passed
flake8...................................................................Passed
pylint...................................................................Passed
```

Or you can run against an especific file:

```console
$ pre-commit run --files docs/index.md
markdownlint.............................................................Passed
Test shell scripts with shellcheck...................(no files to check)Skipped
check json...........................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
pylint...............................................(no files to check)Skipped
```

Pre-commit hooks can be updated using `pre-commit autoupdate`:

```console
$ pre-commit autoupdate
[https://github.com/igorshubovych/markdownlint-cli] already up to date!
[https://github.com/jumanjihouse/pre-commit-hooks] already up to date!
[https://github.com/pre-commit/pre-commit-hooks] already up to date!
[https://github.com/PyCQA/flake8] already up to date!
[https://github.com/PyCQA/pylint] already up to date!
```

### Tests

{% include-markdown "development/ci/tests.md" %}
19 changes: 19 additions & 0 deletions docs/development/ci/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The Release workflow, defined in the `release.yml` file, when a new tag is pushed it triggers: **release-build** and **image-upload**.

```mermaid
graph LR
A[new tag pushed] --> B[deploy-docs];
```

The `deploy-docs` job is triggered when a new release is `published`, this is done by the `release_build` job.

### Docs Update

Uses the `Deploy docs` workflow defined in the `docs.yml` file to generate and deploy the documentation performing the following steps:

1. Checks out the code.
1. Sets up Python 3.x.
1. Exports the release tag version as an environment variable.
1. Sets up the Git configuration for documentation deployment.
1. Installs the required dependencies, including mkdocs-material and mike.
1. Deploys the documentation using the mike deploy command, with specific parameters for updating aliases and including the release tag version in the deployment message.
16 changes: 16 additions & 0 deletions docs/development/ci/tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The Tests Workflow, defined in the `tests.yml` file, has one job: **test-rosa** which includes a matrix on each subplatforms, **hypershift** and **terraform**.

Before installing the clusters, the automation prepares the environment with following tasks:

- Checkout code
- Download tools (ocm, rosa, terraform and aws cli)
- Create AWS account file
- Install python requirements with pip

#### Test Hypershift

It deploys one Hosted Cluster on the Service Cluster assigned to Perf&Scale

#### Test Terraform

It deploys one Rosa Cluster using the terraform ocm provider on Stage Environment
Empty file added docs/development/index.md
Empty file.
Loading

0 comments on commit fb1c7f5

Please sign in to comment.