Skip to content

Merge back release 1.2 #3553

Merge back release 1.2

Merge back release 1.2 #3553

Workflow file for this run

name: C# tests
on:
push:
branches:
- main
- release-*
- v*
paths:
- csharp/**
- glide-core/src/**
- glide-core/redis-rs/redis/src/**
- 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-engine/action.yml
- .github/workflows/create-test-matrices/action.yml
- .github/json_matrices/**
pull_request:
paths:
- csharp/**
- glide-core/src/**
- glide-core/redis-rs/redis/src/**
- 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-engine/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"
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 }}-${{ toJson(inputs) }}
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} {2}', github.ref_name, github.sha, toJson(inputs)) || inputs.name) || '' }}
env:
CARGO_TERM_COLOR: always
jobs:
get-matrices:
runs-on: ubuntu-latest
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: dotnet
# 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 == 'true' || github.event_name == 'schedule' }}
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
- 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: 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 }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ matrix.host.RUNNER }}
path: |
csharp/TestReport.html
benchmarks/results/*
utils/clusters/**
get-containers:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.full-matrix == 'true' || github.event_name == 'schedule' }}
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: dotnet
run-full-matrix: true
containers: true
test-csharp-container:
runs-on: ${{ matrix.host.RUNNER }}
needs: [get-containers]
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
# Don't use generated matrix for dotnet until net6.0 compatibility issues resolved on amazon linux
# dotnet: ${{ fromJson(needs.get-containers.outputs.version-matrix-output) }}
dotnet: ["8.0"]
engine: ${{ fromJson(needs.get-containers.outputs.engine-matrix-output) }}
host: ${{ fromJson(needs.get-containers.outputs.host-matrix-output) }}
container:
image: ${{ matrix.host.IMAGE }}
options: ${{ join(' -q ', matrix.host.CONTAINER_OPTIONS) }} # adding `-q` to bypass empty options
steps:
- name: Install git
run: |
yum update
yum install -y git tar findutils libicu
echo IMAGE=amazonlinux:latest | sed -r 's/:/-/g' >> $GITHUB_ENV
# Replace `:` in the variable otherwise it can't be used in `upload-artifact`
- 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: Test dotnet ${{ matrix.dotnet }}
working-directory: csharp
run: dotnet test --framework net${{ matrix.dotnet }} "-l:html;LogFileName=TestReport.html" --results-directory . -warnaserror
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-reports-dotnet-${{ matrix.dotnet }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ env.IMAGE }}-${{ matrix.host.ARCH }}
path: |
csharp/TestReport.html
benchmarks/results/*
utils/clusters/**
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: lint rust
uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: csharp/lib
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Format
working-directory: csharp
run: dotnet format --verify-no-changes --verbosity diagnostic