Skip to content

Commit

Permalink
feat!: first public release
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloyx committed Jun 20, 2024
0 parents commit d5de048
Show file tree
Hide file tree
Showing 392 changed files with 108,619 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/release-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"release-type": "simple",
"packages": {
".": {
"extra-files": [
{
"type": "json",
"path": "ui/package.json",
"jsonpath": "$.version"
},
"api/pyproject.toml",
"sdk/pyproject.toml",
"spark/pyproject.toml",
"docs/docusaurus.config.js"
]
}
}
}
3 changes: 3 additions & 0 deletions .github/release-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.8.1"
}
55 changes: 55 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Radicalbit OS Platform CI/CD

Here are stored all workflows used to Build/deploy packages and Docker Images for Radicalbit Open Source Platform.

# Convention used

Workflow files are intentionally named as `<service>-<workflow>.yaml` since the workflows themself are triggered only if there are changes in the relative service, and even in the workflow itself.

For example, we need to trigger the SDK workflow, only if there are any changes in the sdk folder or to sdk-workflow.yaml file.

# Local development / testing

It is possible to test workflows in local environment using [act](https://nektosact.com/)

## Prerequisites

- Docker daemon running
- act cli installed

## How To

To view all available jobs to run

```bash
act -l
```

The output should look similar to

```bash
Stage Job ID Job name Workflow name Workflow file Events
0 checkout checkout dummy-api-wf api-dummy.yaml push,pull_request
0 checkout checkout dummy-sdk-wf sdk-dummy.yaml push,pull_request
0 checkout checkout dummy-ui-wf ui-dummy.yaml push,pull_request
```

You can run a given job by specifying the Job ID to act cli

```bash
act -j checkout
```

*Note: if more jobs have the same id, act will run all jobs. To specify a workflow, you can use the `-W <path>` flag:*

```bash
act -j checkout -W .github/workflows/<filename>.yaml
```

### Notes on Docker Actions

Act by default uses a docker image to *"emulate"* the behaviour of a github runner. To use your environment as runner just add the `-P <platform>=self-hosted` flag as shown in the example below:

```bash
act -P ubuntu-22.04=-self-hosted -j checkout -W .github/workflows/<filename>.yaml
```
61 changes: 61 additions & 0 deletions .github/workflows/api-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: api-wf
on:
push:
tags:
- 'v*.*.*'
branches:
- "main"
paths:
- "api/**"
- ".github/workflows/api-**"
pull_request:
branches:
- "*"
paths:
- "api/**"
- ".github/workflows/api-**"

env:
POETRY_VERSION: "1.8.3"
PYTHON_VERSION: "3.11"

jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./api
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
poetry lock
- name: Install dependencies
run: |
poetry install
- name: Ruff Format
run: |
poetry run ruff check
- name: Run tests
run: |
poetry run pytest -v
build-be:
needs: [test]
if: github.event_name != 'pull_request'
uses: radicalbit/radicalbit-github-workflows/.github/workflows/docker.yaml@v1
with:
push: ${{ github.event_name != 'pull_request' }}
context: ./api
image: radicalbit-ai-monitoring-api
tag: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'latest' }}
dockerhub_shortdesc: "Radicalbit AI Monitoring - backend API"
secrets:
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
ORGANIZATION: ${{ secrets.DOCKER_HUB_ORG }}
69 changes: 69 additions & 0 deletions .github/workflows/docs-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docusaurus Workflow

on:
push:
tags:
- 'v*.*.*'
branches:
- "main"
paths:
- "docs/**"
- ".github/workflows/docs-**"
pull_request:
branches:
- "*"
paths:
- "docs/**"
- ".github/workflows/docs-**"

jobs:
build-doc:
name: Build Docusaurus
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: docs/yarn.lock

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build

- name: Upload Build Artifact
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build

deploy-doc:
name: Deploy to GitHub Pages
needs: [build-doc]
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./docs

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
27 changes: 27 additions & 0 deletions .github/workflows/helm-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: update-helm-wf
on:
push:
branches:
- "main"
paths:
- "api/alembic/**"
- ".github/workflows/helm-**"

jobs:
update-chart:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: 'radicalbit/radicalbit-helm-charts'
token: ${{ secrets.GIT_HUB_PAT }}
- name: Update Chart timestamp
uses: mikefarah/[email protected]
with:
cmd: yq -i ".lastUpdateTimestamp = $(date +%s)" "charts/radicalbit-ai-monitoring/values.yaml"
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update Chart timestamp
env:
GITHUB_TOKEN: ${{ secrets.GIT_HUB_PAT }}
78 changes: 78 additions & 0 deletions .github/workflows/migrations-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: migrations-wf
on:
push:
tags:
- 'v*.*.*'
branches:
- "main"
paths:
- "api/alembic/**"
- ".github/workflows/migrations-**"
pull_request:
branches:
- "*"
paths:
- "api/alembic/**"
- ".github/workflows/migrations-**"

env:
POETRY_VERSION: "1.8.3"
PYTHON_VERSION: "3.11"

jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./api
services:
# Setup postgres as service to run test migrations
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
poetry lock
- name: Install dependencies
run: |
poetry install
- name: Run migrations
run: |
poetry run alembic upgrade head
env:
DB_URL: localhost:5432
DB_USER: postgres
DB_PWD: postgres

build-migrations:
needs: [test]
if: github.event_name != 'pull_request'
uses: radicalbit/radicalbit-github-workflows/.github/workflows/docker.yaml@v1
with:
push: ${{ github.event_name != 'pull_request' }}
context: ./api
dockerfile: migrations.Dockerfile
image: radicalbit-ai-monitoring-migrations
tag: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'latest' }}
dockerhub_shortdesc: "Radicalbit AI Monitoring - database migrations"
secrets:
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
ORGANIZATION: ${{ secrets.DOCKER_HUB_ORG }}
Loading

0 comments on commit d5de048

Please sign in to comment.