Skip to content

Commit

Permalink
feat: o3r pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
vscaiceanu-1a committed Oct 16, 2024
1 parent b4c4ebb commit aea27be
Show file tree
Hide file tree
Showing 34 changed files with 901 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
with:
fetch-depth: 2
ref: ${{ inputs.gitRef }}
- name: Update @o3r/pipeline package.json with git commit hash
run: |
jq '.o3rConfig.commitHash = "${{ github.sha }}"' packages/@o3r/pipeline/dist/package.json > tmp.json && mv tmp.json packages/@o3r/pipeline/dist/package.json
- uses: ./tools/github-actions/download-build-output
- uses: ./tools/github-actions/setup
- run: yarn set:version ${{ inputs.version }}
Expand Down
12 changes: 8 additions & 4 deletions .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
],
"timezone": "Europe/Paris",
"ignorePaths": [
"**/node_modules/**",
"**/templates/**"
"**/node_modules/**"
],
"enabledManagers": [
"npm",
Expand Down Expand Up @@ -115,7 +114,7 @@
"enabled": false
}
],
customManagers: [
"customManagers": [
{
"customType": "regex",
"datasourceTemplate": "maven",
Expand All @@ -127,5 +126,10 @@
"\"openApiSupportedVersion\": \"~(?<currentValue>[^\"]+)\""
]
}
]
],
"github-actions": {
"fileMatch": [
"/__dot__github/.*/.+\\.ya?ml$"
]
}
}
4 changes: 2 additions & 2 deletions packages/@o3r/design/.compodocrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/compodoc/compodoc/develop/src/config/schema.json",
"name": "Styling",
"output": "../../../generated-doc/styling",
"name": "Design",
"output": "../../../generated-doc/design",
"tsconfig": "./tsconfig.doc.json",
"assetsFolder": "../../../.attachments",
"disableSourceCode": true,
Expand Down
22 changes: 22 additions & 0 deletions packages/@o3r/pipeline/.compodocrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://raw.githubusercontent.com/compodoc/compodoc/develop/src/config/schema.json",
"name": "Pipeline",
"output": "../../../generated-doc/pipeline",
"tsconfig": "./tsconfig.doc.json",
"assetsFolder": "../../../.attachments",
"disableSourceCode": true,
"disableDomTree": true,
"disableTemplateTab": true,
"disableStyleTab": true,
"disableGraph": true,
"disableCoverage": true,
"disablePrivate": true,
"disableProtected": true,
"disableInternal": true,
"disableLifeCycleHooks": true,
"disableRoutesGraph": true,
"disableSearch": false,
"hideGenerator": true,
"customFavicon": "../../../assets/logo/flavors/otter-128x128.png",
"templates": "../../../compodoc-templates/package"
}
20 changes: 20 additions & 0 deletions packages/@o3r/pipeline/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable quote-props */

module.exports = {
'root': true,
'parserOptions': {
'EXPERIMENTAL_useSourceOfProjectReferenceRedirect': true,
'tsconfigRootDir': __dirname,
'project': [
'tsconfig.build.json',
'tsconfig.builders.json',
'tsconfig.spec.json',
'tsconfig.eslint.json'
],
'sourceType': 'module'
},
'extends': [
'../../../.eslintrc.js'
]
};
1 change: 1 addition & 0 deletions packages/@o3r/pipeline/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist*
Empty file.
60 changes: 60 additions & 0 deletions packages/@o3r/pipeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<h1 align="center">Otter Pipeline</h1>
<p align="center">
<img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
</p>

This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
<br />
<br />

## Description

[![Stable Version](https://img.shields.io/npm/v/@o3r/pipeline?style=for-the-badge)](https://www.npmjs.com/package/@o3r/pipeline)
[![Bundle Size](https://img.shields.io/bundlephobia/min/@o3r/pipeline?color=green&style=for-the-badge)](https://www.npmjs.com/package/@o3r/pipeline)

This module contains tooling around DevOps toolchains.

## How to install

```shell
ng add @o3r/pipeline
```

## Description

The `ng add` schematic for Otter Pipeline helps you set up a DevOps pipeline for your frontend project. This schematic configures the necessary CI runner and npm registry settings to streamline your development workflow.

### Properties

- `toolchain`: The DevOps toolchain to create. For now, only `GitHub` is supported.
- `runner`: The CI runner. Default is `ubuntu-latest`.
- `npmRegistry`: A private npm registry. By default, the public one will be used.

### Usage

Here is an example of how to use the `ng add` schematics with parameters:

```shell
ng add @o3r/pipeline --runner=windows-latest --npmRegistry=https://custom-registry.example.com
```

### Private NPM Registry

When a custom NPM Registry is provided, the schematic will automatically create a `.npmrc` (or a `.yarnrc`) file with the specified registry.
Additionally, it will set the necessary environment variables for the install task.

```yaml
- name: Install
env:
COREPACK_NPM_REGISTRY: https://custom-registry.example.com
COREPACK_INTEGRITY_KEYS: ""
shell: bash
run: npm ci
```
If you choose to run the schematic without specifying an `npmRegistry`, you may need to manually apply these changes afterwards.

### GitHub workflow

The generated pipeline ensures that your code is built, tested and linted on every push or pull request to the main and release branches.
It also automates the versioning thanks to the [Otter - New Version GitHub Action](https://github.com/AmadeusITGroup/otter/tree/main/tools/github-actions/new-version#readme) and release process by creating a new release on GitHub and generating release notes.
14 changes: 14 additions & 0 deletions packages/@o3r/pipeline/collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json",
"schematics": {
"ng-add": {
"description": "Add Otter Pipeline to the project.",
"factory": "./schematics/ng-add/index#ngAdd",
"schema": "./schematics/ng-add/schema.json",
"aliases": [
"install",
"i"
]
}
}
}
9 changes: 9 additions & 0 deletions packages/@o3r/pipeline/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const getJestGlobalConfig = require('../../../jest.config.ut').getJestGlobalConfig;

/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
...getJestGlobalConfig(),
projects: [
'<rootDir>/testing/jest.config.ut.builders.js'
]
};
5 changes: 5 additions & 0 deletions packages/@o3r/pipeline/migration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json",
"schematics": {
}
}
99 changes: 99 additions & 0 deletions packages/@o3r/pipeline/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"name": "@o3r/pipeline",
"version": "0.0.0-placeholder",
"publishConfig": {
"access": "public"
},
"typings": "./dist/src/public_api.d.ts",
"main": "dist/src/public_api.js",
"description": "A package that provides toolchain related helpers.",
"keywords": [
"toolchain",
"pipeline",
"otter",
"otter-module"
],
"scripts": {
"nx": "nx",
"ng": "yarn nx",
"test": "yarn nx test pipeline",
"copy:templates": "yarn cpy 'schematics/**/templates{-*,}/**/*' dist/schematics",
"prepare:build:builders": "yarn cpy '{collection,migration}.json' dist && yarn cpy 'schematics/**/schema.json' dist/schematics && yarn copy:templates",
"prepare:publish": "prepare-publish ./dist",
"build:source": "tsc -b tsconfig.build.json && yarn cpy package.json dist/",
"build:builders": "tsc -b tsconfig.builders.json --pretty && yarn copy:templates && generate-cjs-manifest",
"build": "yarn nx build pipeline",
"postbuild": "patch-package-json-main"
},
"exports": {
"./package.json": {
"default": "./package.json"
},
".": {
"default": "./dist/src/public_api.js",
"typings": "./dist/src/public_api.d.ts"
}
},
"dependencies": {
"js-yaml": "^4.1.0",
"tslib": "^2.6.2"
},
"peerDependencies": {
"@o3r/schematics": "workspace:^",
"@o3r/telemetry": "workspace:^"
},
"peerDependenciesMeta": {
"@o3r/schematics": {
"optional": true
},
"@o3r/telemetry": {
"optional": true
}
},
"devDependencies": {
"@angular-devkit/architect": "~0.1802.0",
"@angular-devkit/core": "~18.2.0",
"@angular-devkit/schematics": "~18.2.0",
"@angular-eslint/eslint-plugin": "~18.3.0",
"@compodoc/compodoc": "^1.1.19",
"@nx/eslint-plugin": "~19.5.0",
"@nx/jest": "~19.5.0",
"@nx/js": "~19.5.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/schematics": "workspace:^",
"@o3r/telemetry": "workspace:^",
"@o3r/test-helpers": "workspace:^",
"@schematics/angular": "~18.2.0",
"@stylistic/eslint-plugin-ts": "~2.4.0",
"@types/jest": "~29.5.2",
"@types/js-yaml": "^4.0.5",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@typescript-eslint/utils": "^7.14.1",
"cpy-cli": "^5.0.0",
"eslint": "^8.57.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-jest": "~28.8.0",
"eslint-plugin-jsdoc": "~48.11.0",
"eslint-plugin-prefer-arrow": "~1.2.3",
"eslint-plugin-unicorn": "^54.0.0",
"jest": "~29.7.0",
"jest-junit": "~16.0.0",
"jsonc-eslint-parser": "~2.4.0",
"nx": "~19.5.0",
"pid-from-port": "^1.1.3",
"ts-jest": "~29.2.0",
"ts-node": "~10.9.2",
"type-fest": "^4.10.2",
"typescript": "~5.5.4"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"schematics": "./collection.json",
"ng-update": {
"migrations": "./migration.json"
}
}
86 changes: 86 additions & 0 deletions packages/@o3r/pipeline/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "pipeline",
"$schema": "https://raw.githubusercontent.com/nrwl/nx/master/packages/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "packages/@o3r/pipeline/src",
"prefix": "o3r",
"targets": {
"build": {
"executor": "nx:run-script",
"outputs": [
"{projectRoot}/dist/package.json"
],
"options": {
"script": "postbuild"
},
"dependsOn": [
"^build",
"build-builders",
"compile"
]
},
"compile": {
"executor": "nx:run-script",
"options": {
"script": "build:source"
},
"inputs": [
"source",
"^source"
]
},
"prepare-build-builders": {
"executor": "nx:run-script",
"options": {
"script": "prepare:build:builders"
}
},
"build-builders": {
"executor": "nx:run-script",
"options": {
"script": "build:builders"
}
},
"lint": {
"options": {
"eslintConfig": "packages/@o3r/pipeline/.eslintrc.js",
"lintFilePatterns": [
"packages/@o3r/pipeline/src/**/*.ts",
"packages/@o3r/pipeline/schematics/**/*.ts",
"packages/@o3r/pipeline/package.json"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "packages/@o3r/pipeline/jest.config.js"
}
},
"test-int": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "packages/@o3r/pipeline/testing/jest.config.it.js"
}
},
"prepare-publish": {
"executor": "nx:run-script",
"options": {
"script": "prepare:publish"
}
},
"publish": {
"executor": "nx:run-commands",
"options": {
"command": "npm publish packages/@o3r/pipeline/dist"
}
},
"documentation": {
"executor": "nx:run-script",
"options": {
"script": "compodoc"
}
}
},
"tags": []
}
Loading

0 comments on commit aea27be

Please sign in to comment.