Skip to content

CI - Minimal and full CI matrix impl #2759

CI - Minimal and full CI matrix impl

CI - Minimal and full CI matrix impl #2759

Workflow file for this run

name: C# tests
on:
push:
branches: ["main"]
paths:
- csharp/**
- glide-core/src/**
- submodules/**
- utils/cluster_manager.py
- .github/workflows/csharp.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/install-valkey/action.yml
- .github/workflows/create-test-matrices/action.yml
- .github/json_matrices/**
pull_request:
paths:
- csharp/**
- glide-core/src/**
- submodules/**
- utils/cluster_manager.py
- .github/workflows/csharp.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/install-valkey/action.yml
- .github/workflows/create-test-matrices/action.yml
- .github/json_matrices/**
workflow_dispatch:
inputs:
full-matrix:
description: "Run the full engine, host, and language version matrix"
required: false
type: boolean
default: "false"
name:
required: false
type: string
description: "(Optional) Test run name"
workflow_call:
permissions:
contents: read
concurrency:
group: C#-${{ github.head_ref || github.ref }}
cancel-in-progress: true
run-name:
# Set custom name if job is started manually and name is given
${{ github.event_name == 'workflow_dispatch' && (inputs.name == '' && format('{0} @ {1}', github.ref_name, github.sha) || inputs.name) || '' }}
jobs:
get-matrices:
runs-on: ubuntu-latest
# Avoid running on schedule for forks
if: (github.repository_owner == 'valkey-io' || github.event_name != 'schedule') || github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
outputs:
engine-matrix-output: ${{ steps.get-matrices.outputs.engine-matrix-output }}
host-matrix-output: ${{ steps.get-matrices.outputs.host-matrix-output }}
version-matrix-output: ${{ steps.get-matrices.outputs.version-matrix-output }}
steps:
- uses: actions/checkout@v4
- id: get-matrices
uses: ./.github/workflows/create-test-matrices
with:
language-name: csharp
# Run full test matrix if job started by cron or it was explictly specified by a person who triggered the workflow
run-full-matrix: ${{ github.event.inputs.full-matrix || github.event_name == 'schedule' || 'false' }}
test-csharp:
needs: get-matrices
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
dotnet: ${{ fromJson(needs.get-matrices.outputs.version-matrix-output) }}
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }}
host: ${{ fromJson(needs.get-matrices.outputs.host-matrix-output) }}
runs-on: ${{ matrix.host.RUNNER }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up dotnet ${{ matrix.dotnet }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Install shared software dependencies
uses: ./.github/workflows/install-shared-dependencies
with:
os: ${{ matrix.host.OS }}
target: ${{ matrix.host.TARGET }}
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}
- name: Format
working-directory: ./csharp
run: dotnet format --verify-no-changes --verbosity diagnostic
- name: Test dotnet ${{ matrix.dotnet }}
working-directory: ./csharp
run: dotnet test --framework net${{ matrix.dotnet }} "-l:html;LogFileName=TestReport.html" --results-directory . -warnaserror
- uses: ./.github/workflows/test-benchmark
with:
language-flag: -csharp -dotnet-framework net${{ matrix.dotnet }}
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-reports-dotnet-${{ matrix.dotnet }}-redis-${{ matrix.redis }}-${{ matrix.host.RUNNER }}
path: |
csharp/TestReport.html
benchmarks/results/*
utils/clusters/**
# TODO Add amazonlinux
lint-rust:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./csharp/lib
github-token: ${{ secrets.GITHUB_TOKEN }}