frontend-commons/README.md
2025-10-22 23:03:21 +02:00

108 lines
5.4 KiB
Markdown

# Frontend Commons
This repository contains consolidated boilerplates, CI/CD pipelines, and utilities for setting up frontend projects.
## CI/CD
GitHub (forgejo) pipelines and other CI/CD utilities for the frontends Phoenix Technologies maintains. Its purpose is to provide unified and consistent CI/CD workflows for all recent frontend projects developed and operated within our company, ensuring alignment, quality, and maintainability across setups.
## .Github Workflows: Build and push containers
Containers are built using dedicated `Dockerfile`s located in the `/docker` directory within each project repository. After the build, the images are pushed to the registry.
### `Build`
A standard single-repository project with a `package.json` file located at the root, managing dependencies for the entire project.
##### Vars (inherited)
Setuped on org or repo level.
| Key | Description | Required |
| ------------ | --------------- | -------- |
| `IMAGE_PATH` | Image base path | ✓ |
##### Inputs
| Key | Description | Required |
| ------------------------- | ------------------------------- | -------- |
| `PACKAGE_WRITER_USERNAME` | User name of the package writer | ✓ |
##### Secrets
Note: Secrets must be explicitly passed to workflows, even if they are defined at the repository or organization level. This is due to the way Forgejo handles secrets in workflows.
| Key | Description | Required |
| --------------------------- | --------------------------------------------------------- | -------- |
| `PACKAGE_WRITE_TOKEN` | Accesstoken of the package writer | ✓ |
| `FONTAWESOME_PACKAGE_TOKEN` | Fontawesome Pro library token (Only needed if FA in use ) | |
### `Build-Monorepo`
A monorepo project based on Turborepo, with individual projects located under the `/apps/<PROJECT_ID>` directory.
##### Vars (inherited)
Setuped on org or repo level.
| Key | Description | Required |
| ----------------- | ------------------ | -------- |
| `IMAGE_BASE_PATH` | Image base path | ✓ |
| `TURBO_TEAM` | Turbo repo team ID | |
| `TURBO_API` | Turbo repo api url | |
##### Inputs
| Key | Description | Required |
| ------------------------- | ------------------------------- | -------- |
| `PACKAGE_WRITER_USERNAME` | User name of the package writer | ✓ |
| `PROJECT_ID` | ID of the projcet | ✓ |
##### Secrets
Note: Secrets must be explicitly passed to workflows, even if they are defined at the repository or organization level. This is due to the way Forgejo handles secrets in workflows.
| Key | Description | Required |
| --------------------------- | -------------------------------------------------- | -------- |
| `PACKAGE_WRITE_TOKEN` | Access token of the package writer | ✓ |
| `TURBO_TOKEN` | Access token for turbo cache | |
| `FONTAWESOME_PACKAGE_TOKEN` | Fontawesome Pro library token (Only if fa in use ) | |
## .Github Workflows: Linting, type checking, code analyzis, dependency tracking
### `Lint`
Linting, type checking, sonarqube, dependency tracking, any testing
##### Vars (inherited)
Setuped on org or repo level.
| Key | Description | Required |
| ---------------- | ------------------------------------------------- | -------- |
| `TURBO_TEAM` | Turbo repo team ID (only applicable on monorepos) | |
| `TURBO_API` | Turbo repo api url (only applicable on monorepos) | |
| `SONAR_HOST_URL` | Sonarqube Host (required if sonarqube is enabled) | |
##### Inputs
| Key | Description | Required |
| ------------------- | ---------------------------------------------------------------------------------- | -------- |
| `SONARQUBE_ENABLED` | Send source to sonarqube for code analysis; default: `false` | |
| `TESTS_ENABLED` | Enable test suites; default: `false` | |
| `SETUP_REPO_SCRIPT` | Script which runs after install for setting up the repo; default: `yarn run setup` | |
| `TEST_SCRIPT` | Script which runs when tests are enabled; default: `yarn run test:coverage:lcov` | |
##### Secrets
Note: Secrets must be explicitly passed to workflows, even if they are defined at the repository or organization level. This is due to the way Forgejo handles secrets in workflows.
| Key | Description | Required |
| --------------------------- | ----------------------------------------------------------- | -------- |
| `TURBO_TOKEN` | Access token for turbo cache (only applicable on monorepos) | |
| `FONTAWESOME_PACKAGE_TOKEN` | Fontawesome Pro library token (Only needed if FA in use ) | |
| `SONAR_TOKEN` | Sonarqube access token (required if sonarqube is enabled) | |
## Authors
- Thomas Sauter, thomas.sauter@phoenix-technologies.ch