Skip to content

Commit

Permalink
CI - Minimal and full CI matrix impl (valkey-io#2051)
Browse files Browse the repository at this point in the history
* CI - Minimal and full CI matrix impl

Signed-off-by: avifenesh <[email protected]>

* Fix mypy failing (valkey-io#2453)

---------

Signed-off-by: Shoham Elias <[email protected]>
Signed-off-by: avifenesh <[email protected]>

* Python: adds JSON.ARRLEN command (valkey-io#2403)

---------

Signed-off-by: Shoham Elias <[email protected]>
Signed-off-by: Shoham Elias <[email protected]>
Signed-off-by: avifenesh <[email protected]>

---------

Signed-off-by: avifenesh <[email protected]>
Signed-off-by: Shoham Elias <[email protected]>
Signed-off-by: Shoham Elias <[email protected]>
Co-authored-by: Shoham Elias <[email protected]>
  • Loading branch information
avifenesh and shohamazon authored Oct 22, 2024
1 parent b226bd3 commit bcc6b00
Show file tree
Hide file tree
Showing 39 changed files with 1,072 additions and 763 deletions.
132 changes: 132 additions & 0 deletions .github/DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# CI/CD Workflow Guide

TODO: Add a description of the CI/CD workflow and its components.

### Overview

Our CI/CD pipeline tests and builds our project across multiple languages, versions, and environments. This guide outlines the key components and processes of our workflow.

### Workflow Triggers

- Push to `main` branch
- Pull requests
- Scheduled runs (daily)
- Manual trigger (workflow_dispatch)

### Language-Specific Workflows

Each language has its own workflow file with similar structure but language-specific steps, for example python.yml for Python, or java.yml for Java.

### Shared Components

#### Matrix Files

While workflows are language-specific, the matrix files are shared across all workflows.
Workflows are starting by loading the matrix files from the `.github/json_matrices` directory.

- `engine-matrix.json`: Defines the versions of Valkey engine to test against.
- `build-matrix.json`: Defines the host environments for testing.
- `supported-languages-version.json`: Defines the supported versions of languages.

All matrices have a `run` like field which specifies if the configuration should be tested on every workflow run.
This allows for flexible control over which configurations are tested in different scenarios, optimizing CI/CD performance and resource usage.

#### Engine Matrix (engine-matrix.json)

Defines the versions of Valkey engine to test against:

```json
[{ "type": "valkey", "version": "7.2.5", "run": "always" }]
```

- `type`: The type of engine (e.g., Valkey, Redis).
- `version`: The version of the engine.
- `run`: Specifies if the engine version should be tested on every workflow.

#### Build Matrix (build-matrix.json)

Defines the host environments for testing:

```json
[
{
"OS": "ubuntu",
"RUNNER": "ubuntu-latest",
"TARGET": "x86_64-unknown-linux-gnu",
"run": ["always", "python", "node", "java"]
}
// ... other configurations
]
```

- `OS`: The operating system of the host.
- `RUNNER`: The GitHub runner to use.
- `TARGET`: The target environment.
- `run`: Specifies which language workflows should use this host configuration, always means run on each workflow trigger.

#### Supported Languages Version (supported-languages-version.json)

Defines the supported versions of languages:

```json
[
{
"language": "java",
"versions": ["11", "17"],
"always-run-versions": ["17"]
}
// ... other configurations
]
```

- `language`: The language for which the version is supported.
- `versions`: The full versions supported of the language which will test against scheduled.
- `always-run-versions`: The versions which will be tested in every workflow run.

#### Triggering Workflows

Push to main or create a pull request to run workflows automatically.
Use workflow_dispatch for manual triggers, accepting inputs of full-matrix which is a boolean value to run all configurations.
Scheduled runs are triggered daily to ensure regular testing of all configurations.

### Mutual vs. Language-Specific Components

#### Mutual

`Matrix files` - `.github/json_matrices`
`Shared dependencies installation` - `.github/workflows/install-shared-dependencies/action.yml`
`Linting Rust` - `.github/workflows/lint-rust/action.yml`

#### Language-Specific

`Package manager commands`
`Testing frameworks`
`Build processes`

### Customizing Workflows

Modify `[language].yml` files to adjust language-specific steps.
Update matrix files to change tested versions or environments.
Adjust cron schedules in workflow files for different timing of scheduled runs.

### Workflow Matrices

We use dynamic matrices for our CI/CD workflows, which are created using the `create-test-matrices` action. This action is defined in `.github/workflows/create-test-matrices/action.yml`.

#### How it works

1. The action is called with a `language-name` input and `dispatch-run-full-matrix` input.
2. It reads the `engine-matrix.json`, `build-matrix.json`, and `supported-languages-version.json` files.
3. It filters the matrices based on the inputs and the event type.
4. It generates three matrices:
- Engine matrix: Defines the types and versions of the engine to test against, for example Valkey 7.2.5.
- Host matrix: Defines the host platforms to run the tests on, for example Ubuntu on ARM64.
- Language-version matrix: Defines the supported versions of languages, for example python 3.8.

#### Outputs

- `engine-matrix-output`: The generated engine matrix.
- `host-matrix-output`: The generated host matrix.
- `language-version-matrix-output`: The generated language version matrix.

This dynamic matrix generation allows for flexible and efficient CI/CD workflows, adapting the test configurations based on the type of change and the specific language being tested.
236 changes: 118 additions & 118 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,134 +5,134 @@ title: "(topic): (short issue description)"
labels: [bug, needs-triage]
assignees: []
body:
- type: textarea
id: description
attributes:
label: Describe the bug
description: What is the problem? A clear and concise description of the bug.
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: What is the problem? A clear and concise description of the bug.
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: |
What did you expect to happen?
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: |
What did you expect to happen?
validations:
required: true

- type: textarea
id: current
attributes:
label: Current Behavior
description: |
What actually happened?
Please include full errors, uncaught exceptions, stack traces, and relevant logs.
If service responses are relevant, please include wire logs.
validations:
required: true
- type: textarea
id: current
attributes:
label: Current Behavior
description: |
What actually happened?
- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: |
Provide a self-contained, concise snippet of code that can be used to reproduce the issue.
For more complex issues provide a repo with the smallest sample that reproduces the bug.
Avoid including business logic or unrelated code, it makes diagnosis more difficult.
The code sample should be an SSCCE. See http://sscce.org/ for details. In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true
Please include full errors, uncaught exceptions, stack traces, and relevant logs.
If service responses are relevant, please include wire logs.
validations:
required: true

- type: textarea
id: solution
attributes:
label: Possible Solution
description: |
Suggest a fix/reason for the bug
validations:
required: false
- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: |
Provide a self-contained, concise snippet of code that can be used to reproduce the issue.
For more complex issues provide a repo with the smallest sample that reproduces the bug.
- type: textarea
id: context
attributes:
label: Additional Information/Context
description: |
Anything else that might be relevant for troubleshooting this bug. Providing context helps us come up with a solution that is most useful in the real world.
validations:
required: false
Avoid including business logic or unrelated code, it makes diagnosis more difficult.
The code sample should be an SSCCE. See http://sscce.org/ for details. In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true

- type: input
id: client-version
attributes:
label: Client version used
validations:
required: true
- type: textarea
id: solution
attributes:
label: Possible Solution
description: |
Suggest a fix/reason for the bug
validations:
required: false

- type: input
id: engine-version
attributes:
label: Engine type and version
description: E.g. Valkey 7.0
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional Information/Context
description: |
Anything else that might be relevant for troubleshooting this bug. Providing context helps us come up with a solution that is most useful in the real world.
validations:
required: false

- type: input
id: operating-system
attributes:
label: OS
validations:
required: true
- type: input
id: client-version
attributes:
label: Client version used
validations:
required: true

- type: dropdown
id: language
attributes:
label: Language
multiple: true
options:
- TypeScript
- Python
- Java
- Rust
- Go
- .Net
validations:
required: true
- type: input
id: engine-version
attributes:
label: Engine type and version
description: E.g. Valkey 7.0
validations:
required: true

- type: input
id: language-version
attributes:
label: Language Version
description: E.g. TypeScript (5.2.2) | Python (3.9)
validations:
required: true
- type: input
id: operating-system
attributes:
label: OS
validations:
required: true

- type: textarea
id: cluster-info
attributes:
label: Cluster information
description: |
Cluster information, cluster topology, number of shards, number of replicas, used data types.
validations:
required: false
- type: dropdown
id: language
attributes:
label: Language
multiple: true
options:
- TypeScript
- Python
- Java
- Rust
- Go
- .Net
validations:
required: true

- type: textarea
id: logs
attributes:
label: Logs
description: |
Client and/or server logs.
validations:
required: false
- type: input
id: language-version
attributes:
label: Language Version
description: E.g. TypeScript (5.2.2) | Python (3.9)
validations:
required: true

- type: textarea
id: other
attributes:
label: Other information
description: |
e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, etc
validations:
required: false
- type: textarea
id: cluster-info
attributes:
label: Cluster information
description: |
Cluster information, cluster topology, number of shards, number of replicas, used data types.
validations:
required: false

- type: textarea
id: logs
attributes:
label: Logs
description: |
Client and/or server logs.
validations:
required: false

- type: textarea
id: other
attributes:
label: Other information
description: |
e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, etc
validations:
required: false
Loading

0 comments on commit bcc6b00

Please sign in to comment.