# π Local GitHub Actions Testing with act
## π Workflow Overview
This repository uses modular, clearly named workflows for CI, integration tests, packaging, Docker, and releases.
A top-level **`0_ci-cd.yaml`** orchestrates the process for pushes to `main`, running **Tests** first and triggering the **Release** workflow only if they pass.
1. π§ͺ **Tests** β lint, types checks, unit, integration and e2e tests.
- π§© **Unit Tests** β Run unit tests
- π³ **Docker Integration & E2E Tests** β Run Docker integration and end-to-end tests
- βΈοΈ **Kubernetes Integration & E2E Tests** β Run Kubernetes integration and end-to-end tests
2. π **Full Release Workflow** β Builds and publishes both the Python package and Docker image, then creates a GitHub Release
- π¦ **Build & Publish Python Package** β Build and (optionally) publish the Python package
- π **Build & Push Docker Image** β Build and (optionally) push the Docker image
- π **Create GitHub Release Only** β Create a GitHub Release from already published artifacts
3. π **CI/CD Orchestration** (`3_ci-cd.yaml`) β Runs Tests β Release when pushing to `main`.
## β‘ Quick Start
1. π οΈ **Install [act](https://github.com/nektos/act):**
```sh
brew install act
```
Or, for any system:
```sh
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
```
π For more install options, see: <https://nektosact.com/installation/index.html>
> _Warning: act is not always realiable_.
## π³ Docker Image for act
```sh
docker pull catthehacker/ubuntu:act-latest
```
## 1. π§ͺ Tests
Run all CI checks (lint, types checks, unit, integration and e2e tests):
```sh
act -W .github/workflows/1_tests.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
### 1.1. π§© Unit Tests
Run unit tests:
```sh
act -W .github/workflows/1.2_unit_tests.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
### 1.2. π³ Docker Integration & E2E Tests
Run Docker integration and end-to-end tests:
```sh
act -W .github/workflows/1.3_docker_tests.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
### 1.3. βΈοΈ Kubernetes Integration & E2E Tests
Run Kubernetes integration and end-to-end tests:
```sh
act -W .github/workflows/1.4_kubernetes_tests.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## 2. π Full Release Workflow
Builds and publishes both the Python package and Docker image, then creates a GitHub Release:
```sh
act workflow_dispatch -W .github/workflows/2_release.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## 2.1. π¦ Build & Publish Python Package
Build and (optionally) publish the Python package:
```sh
act -W .github/workflows/2.1_build-python-package.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## 2.2. π Build & Push Docker Image
Build and (optionally) push the Docker image:
```sh
act -W .github/workflows/2.2_build-docker-image.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## 2.3. π Create GitHub Release Only
Create a GitHub Release from already published artifacts:
```sh
act -W .github/workflows/2.3_create-github-release.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## 3. π CI/CD Orchestration
Run the combined CI + Release process (push to main simulation):
```sh
act -W .github/workflows/3_ci-cd.yaml -P ubuntu-latest=catthehacker/ubuntu:act-latest --rm
```
## π‘ Notes
- π³ You need Docker running.
- π Use the same Python version as in `.python-version` for best results.
- π§© Each workflow is modular and can be rerun independently for robust, atomic releases.
- π·οΈ The main release workflow only creates a GitHub Release if both the Python package and Docker image are published successfully.
That's it. πβ¨