diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 2e0bf77..3f66d63 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -3,7 +3,7 @@ # GitHub Reusable Workflow: Node.js Continuous Integration
- Node.js Continuous Integration + Node.js Continuous Integration
--- @@ -183,7 +183,7 @@ jobs: # "credentials": { # "username": "myusername" # }, - # pathMapping: { + # "pathMapping": { # "/app": "./relative/path/to/app" # } # } @@ -216,66 +216,66 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | -| **`runs-on`** | JSON array of runner(s) to use. | **false** | **string** | `["ubuntu-latest"]` | -| | See . | | | | -| **`build`** | Build parameters. Must be a string or a JSON object. | **false** | **string** | `build` | -| | For string, provide a list of commands to run during the build step, one per line. | | | | -| | For JSON object, provide the following properties: | | | | -| | | | | | -| | - `commands`: Array of commands to run during the build step. | | | | -| | - `env`: Object of environment variables to set during the build step. | | | | -| | - `artifact`: String or array of strings specifying paths to artifacts to upload after the build | | | | -| | | | | | -| | Example: | | | | -| |
{
 "commands": [
 "build",
 "generate-artifacts"
 ],
 "env": {
 "CUSTOM_ENV_VAR": "value"
 },
 "artifact": [
 "dist/",
 "packages/package-a/build/"
 ]
}
| | | | -| **`checks`** | Optional flag to enable check steps. | **false** | **boolean** | `true` | -| **`lint`** | Whether to enable linting. | **false** | **string** | `true` | -| | Set to `null` or empty to disable. | | | | -| | Accepts a JSON object for lint options. See [lint action](../../actions/lint/README.md). | | | | -| | It should generate lint reports in standard formats. | | | | -| | | | | | -| | Example: | | | | -| | | | | | -| |
{
 "lint:ci": "eslint . --output-file eslint-report.json --format json"
}
| | | | -| **`code-ql`** | Code QL analysis language. | **false** | **string** | `typescript` | -| | See . | | | | -| **`dependency-review`** | Enable dependency review scan. | **false** | **boolean** | `true` | -| | Works with public repositories and private repositories with a GitHub Advanced Security license. | | | | -| | See . | | | | -| **`test`** | Whether to enable testing. | **false** | **string** | `true` | -| | Set to `null` or empty to disable. | | | | -| | Accepts a JSON object for test options. See [test action](../../actions/test/README.md). | | | | -| | If coverage is enabled, it should generate test and coverage reports in standard formats. | | | | -| | | | | | -| | Example: | | | | -| | | | | | -| |
{
 "test:ci": "vitest run --reporter=default --reporter=junit --outputFile=junit.xml --coverage.enabled --coverage.reporter=lcov --coverage.reporter=text"
}
| | | | -| **`working-directory`** | Working directory where the dependencies are installed. | **false** | **string** | `.` | -| **`container`** | Container configuration to run CI steps in. | **false** | **string** | - | -| | Accepts either a string (container image name) or a JSON object with container options. | | | | -| | | | | | -| | String format (simple): | | | | -| | | | | | -| |
container: "node:18"
| | | | -| | JSON object format (advanced): | | | | -| | | | | | -| |
{
 "image": "node:18",
 "env": {
 "NODE_ENV": "production"
 },
 "options": "--cpus 2",
 "ports": [8080, 3000],
 "volumes": ["/tmp:/tmp", "/cache:/cache"],
 "credentials": {
 "username": "myusername"
 },
 pathMapping: {
 "/app": "./relative/path/to/app"
 }
}
| | | | -| | Supported properties: | | | | -| | | | | | -| | - `image` (required) | | | | -| | - `env` (object) | | | | -| | - `options` (string) | | | | -| | - `ports` (array) | | | | -| | - `volumes` (array) | | | | -| | - `credentials` (object with `username`). | | | | -| | - `pathMapping` (object) path mapping from container paths to repository paths. Defaults is working directory is mapped with repository root. | | | | -| | | | | | -| | See . | | | | -| | | | | | -| | When specified, steps will execute inside this container instead of checking out code. | | | | -| | The container should have the project code and dependencies pre-installed. | | | | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | +| **`runs-on`** | JSON array of runner(s) to use. | **false** | **string** | `["ubuntu-latest"]` | +| | See . | | | | +| **`build`** | Build parameters. Must be a string or a JSON object. | **false** | **string** | `build` | +| | For string, provide a list of commands to run during the build step, one per line. | | | | +| | For JSON object, provide the following properties: | | | | +| | | | | | +| | - `commands`: Array of commands to run during the build step. | | | | +| | - `env`: Object of environment variables to set during the build step. | | | | +| | - `artifact`: String or array of strings specifying paths to artifacts to upload after the build | | | | +| | | | | | +| | Example: | | | | +| |
{
 "commands": [
 "build",
 "generate-artifacts"
 ],
 "env": {
 "CUSTOM_ENV_VAR": "value"
 },
 "artifact": [
 "dist/",
 "packages/package-a/build/"
 ]
}
| | | | +| **`checks`** | Optional flag to enable check steps. | **false** | **boolean** | `true` | +| **`lint`** | Whether to enable linting. | **false** | **string** | `true` | +| | Set to `null` or empty to disable. | | | | +| | Accepts a JSON object for lint options. See [lint action](../../actions/lint/README.md). | | | | +| | It should generate lint reports in standard formats. | | | | +| | | | | | +| | Example: | | | | +| | | | | | +| |
{
 "lint:ci": "eslint . --output-file eslint-report.json --format json"
}
| | | | +| **`code-ql`** | Code QL analysis language. | **false** | **string** | `typescript` | +| | See . | | | | +| **`dependency-review`** | Enable dependency review scan. | **false** | **boolean** | `true` | +| | Works with public repositories and private repositories with a GitHub Advanced Security license. | | | | +| | See . | | | | +| **`test`** | Whether to enable testing. | **false** | **string** | `true` | +| | Set to `null` or empty to disable. | | | | +| | Accepts a JSON object for test options. See [test action](../../actions/test/README.md). | | | | +| | If coverage is enabled, it should generate test and coverage reports in standard formats. | | | | +| | | | | | +| | Example: | | | | +| | | | | | +| |
{
 "test:ci": "vitest run --reporter=default --reporter=junit --outputFile=junit.xml --coverage.enabled --coverage.reporter=lcov --coverage.reporter=text"
}
| | | | +| **`working-directory`** | Working directory where the dependencies are installed. | **false** | **string** | `.` | +| **`container`** | Container configuration to run CI steps in. | **false** | **string** | - | +| | Accepts either a string (container image name) or a JSON object with container options. | | | | +| | | | | | +| | String format (simple): | | | | +| | | | | | +| |
container: "node:18"
| | | | +| | JSON object format (advanced): | | | | +| | | | | | +| |
{
 "image": "node:18",
 "env": {
 "NODE_ENV": "production"
 },
 "options": "--cpus 2",
 "ports": [8080, 3000],
 "volumes": ["/tmp:/tmp", "/cache:/cache"],
 "credentials": {
 "username": "myusername"
 },
 "pathMapping": {
 "/app": "./relative/path/to/app"
 }
}
| | | | +| | Supported properties: | | | | +| | | | | | +| | - `image` (required) | | | | +| | - `env` (object) | | | | +| | - `options` (string) | | | | +| | - `ports` (array) | | | | +| | - `volumes` (array) | | | | +| | - `credentials` (object with `username`). | | | | +| | - `pathMapping` (object) path mapping from container paths to repository paths. Defaults is working directory is mapped with repository root. | | | | +| | | | | | +| | See . | | | | +| | | | | | +| | When specified, steps will execute inside this container instead of checking out code. | | | | +| | The container should have the project code and dependencies pre-installed. | | | | diff --git a/actions/lint/README.md b/actions/lint/README.md index 3d70567..dee9663 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -3,7 +3,7 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stY2lyY2xlIiBjb2xvcj0iYmx1ZSI+PHBhdGggZD0iTTIyIDExLjA4VjEyYTEwIDEwIDAgMSAxLTUuOTMtOS4xNCI+PC9wYXRoPjxwb2x5bGluZSBwb2ludHM9IjIyIDQgMTIgMTQuMDEgOSAxMS4wMSI+PC9wb2x5bGluZT48L3N2Zz4=) GitHub Action: Lint
- Lint + Lint
--- @@ -53,13 +53,13 @@ Action to lint Node.js projects with support for pull request reporting and anno # Default: `lint:ci` command: lint:ci - # Optional lint report path forwarded to the [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action. + # Optional lint report path forwarded to the [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action. # Provide an absolute path or one relative to the working directory. # When omitted, the action falls back to `auto:lint` detection. report-file: "" # Optional path mapping to adjust file paths in test and coverage reports. - # See the [parse-ci-reports documentation](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) for details. + # See the [parse-ci-reports documentation](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) for details. path-mapping: "" ``` @@ -68,23 +68,23 @@ Action to lint Node.js projects with support for pull request reporting and anno ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Working directory where lint commands are executed. | **false** | `.` | -| | Can be absolute or relative to the repository root. | | | -| **`container`** | Whether running in container mode (skips checkout and node setup) | **false** | `false` | -| **`command`** | npm/pnpm/Yarn script command to run for linting. | **false** | `lint:ci` | -| | This should be a script defined in your `package.json`. | | | -| | The command should generate lint report files in a standard format. | | | -| | | | | -| | ESLint: `eslint --format json -o eslint-report.json .` | | | -| | Prettier: `prettier --check . \| tee prettier-report.txt` | | | -| | Astro: `astro check \| tee astro-report.txt` | | | -| **`report-file`** | Optional lint report path forwarded to the [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action. | **false** | - | -| | Provide an absolute path or one relative to the working directory. | | | -| | When omitted, the action falls back to `auto:lint` detection. | | | -| **`path-mapping`** | Optional path mapping to adjust file paths in test and coverage reports. | **false** | - | -| | See the [parse-ci-reports documentation](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) for details. | | | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Working directory where lint commands are executed. | **false** | `.` | +| | Can be absolute or relative to the repository root. | | | +| **`container`** | Whether running in container mode (skips checkout and node setup) | **false** | `false` | +| **`command`** | npm/pnpm/Yarn script command to run for linting. | **false** | `lint:ci` | +| | This should be a script defined in your `package.json`. | | | +| | The command should generate lint report files in a standard format. | | | +| | | | | +| | ESLint: `eslint --format json -o eslint-report.json .` | | | +| | Prettier: `prettier --check . \| tee prettier-report.txt` | | | +| | Astro: `astro check \| tee astro-report.txt` | | | +| **`report-file`** | Optional lint report path forwarded to the [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action. | **false** | - | +| | Provide an absolute path or one relative to the working directory. | | | +| | When omitted, the action falls back to `auto:lint` detection. | | | +| **`path-mapping`** | Optional path mapping to adjust file paths in test and coverage reports. | **false** | - | +| | See the [parse-ci-reports documentation](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) for details. | | | diff --git a/actions/test/README.md b/actions/test/README.md index f6dae4a..532b8f7 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -3,7 +3,7 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Test
- Test + Test
--- @@ -53,14 +53,14 @@ Action to test Node.js projects with support for coverage reporting and pull req command: test:ci # Code coverage reporter to use. Supported values: - # - `github`: Parse coverage reports via [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action, with GitHub summaries/PR comments + # - `github`: Parse coverage reports via [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action, with GitHub summaries/PR comments # - `codecov`: Upload coverage to Codecov # - `""` or `null`: No coverage reporting # # Default: `github` coverage: github - # Optional test and coverage report paths forwarded to the [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action. + # Optional test and coverage report paths forwarded to the [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action. # Supports multiple formats (Cobertura, OpenCover, lcov, etc.). # Provide absolute paths or paths relative to the working directory. # Multiple entries can be separated by newlines, commas, or semicolons. @@ -81,30 +81,30 @@ Action to test Node.js projects with support for coverage reporting and pull req ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Working directory where test commands are executed. | **false** | `.` | -| | Can be absolute or relative to the repository root. | | | -| **`container`** | Whether running in container mode (skips checkout and node setup) | **false** | `false` | -| **`command`** | npm/pnpm/Yarn script command to run for testing. | **false** | `test:ci` | -| | This should be a script defined in your `package.json`. | | | -| | The command should generate coverage report files in a standard format (Cobertura XML, lcov, etc.). | | | -| | | | | -| | Vitest: `vitest run --reporter=default --reporter=junit --outputFile=junit.xml --coverage.enabled --coverage.reporter=lcov --coverage.reporter=text` | | | -| | Jest: `jest --ci --reporters=default --reporters=jest-junit --coverage` | | | -| **`coverage`** | Code coverage reporter to use. Supported values: | **false** | `github` | -| | - `github`: Parse coverage reports via [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action, with GitHub summaries/PR comments | | | -| | - `codecov`: Upload coverage to Codecov | | | -| | - `""` or `null`: No coverage reporting | | | -| **`report-file`** | Optional test and coverage report paths forwarded to the [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action. | **false** | - | -| | Supports multiple formats (Cobertura, OpenCover, lcov, etc.). | | | -| | Provide absolute paths or paths relative to the working directory. | | | -| | Multiple entries can be separated by newlines, commas, or semicolons. | | | -| | When omitted, the action falls back to `auto:test,auto:coverage` detection. | | | -| **`path-mapping`** | Optional path mapping to adjust file paths in test and coverage reports. | **false** | - | -| | See the [parse-ci-reports documentation](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) for details. | | | -| **`github-token`** | GitHub token for coverage PR comments. | **false** | - | -| | Required when coverage is set to `github`. | | | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Working directory where test commands are executed. | **false** | `.` | +| | Can be absolute or relative to the repository root. | | | +| **`container`** | Whether running in container mode (skips checkout and node setup) | **false** | `false` | +| **`command`** | npm/pnpm/Yarn script command to run for testing. | **false** | `test:ci` | +| | This should be a script defined in your `package.json`. | | | +| | The command should generate coverage report files in a standard format (Cobertura XML, lcov, etc.). | | | +| | | | | +| | Vitest: `vitest run --reporter=default --reporter=junit --outputFile=junit.xml --coverage.enabled --coverage.reporter=lcov --coverage.reporter=text` | | | +| | Jest: `jest --ci --reporters=default --reporters=jest-junit --coverage` | | | +| **`coverage`** | Code coverage reporter to use. Supported values: | **false** | `github` | +| | - `github`: Parse coverage reports via [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action, with GitHub summaries/PR comments | | | +| | - `codecov`: Upload coverage to Codecov | | | +| | - `""` or `null`: No coverage reporting | | | +| **`report-file`** | Optional test and coverage report paths forwarded to the [parse-ci-reports](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/parse-ci-reports) action. | **false** | - | +| | Supports multiple formats (Cobertura, OpenCover, lcov, etc.). | | | +| | Provide absolute paths or paths relative to the working directory. | | | +| | Multiple entries can be separated by newlines, commas, or semicolons. | | | +| | When omitted, the action falls back to `auto:test,auto:coverage` detection. | | | +| **`path-mapping`** | Optional path mapping to adjust file paths in test and coverage reports. | **false** | - | +| | See the [parse-ci-reports documentation](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) for details. | | | +| **`github-token`** | GitHub token for coverage PR comments. | **false** | - | +| | Required when coverage is set to `github`. | | |