-
Notifications
You must be signed in to change notification settings - Fork 58
140 lines (121 loc) · 5.04 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Rust tests
on:
push:
branches:
- main
- release-*
- v*
paths:
- logger_core/**
- glide-core/**
- glide-core/redis-rs/redis/src/**
- utils/cluster_manager.py
- .github/workflows/rust.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-engine/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/create-test-matrices/action.yml
- .github/json_matrices/**
- deny.toml
pull_request:
paths:
- logger_core/**
- glide-core/**
- glide-core/redis-rs/redis/src/**
- utils/cluster_manager.py
- .github/workflows/rust.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-engine/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/create-test-matrices/action.yml
- .github/json_matrices/**
- deny.toml
workflow_dispatch:
inputs:
full-matrix:
description: "Run the full engine and host matrix"
type: boolean
default: false
name:
required: false
type: string
description: "(Optional) Test run name"
workflow_call:
concurrency:
group: rust-${{ github.head_ref || github.ref }}-${{ toJson(inputs) }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
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) || '' }}
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 }}
# language version matrix is omitted
steps:
- uses: actions/checkout@v4
- id: get-matrices
uses: ./.github/workflows/create-test-matrices
with:
language-name: rust
# 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' }}
tests:
runs-on: ${{ matrix.host.RUNNER }}
needs: get-matrices
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }}
host: ${{ fromJson(needs.get-matrices.outputs.host-matrix-output) }}
steps:
- uses: actions/checkout@v4
- name: Install shared software dependencies
uses: ./.github/workflows/install-shared-dependencies
with:
os: "ubuntu"
target: "x86_64-unknown-linux-gnu"
engine-version: ${{ matrix.engine.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: Run tests
working-directory: ./glide-core
run: cargo test --all-features --release -- --test-threads=1 # TODO remove the concurrency limit after we fix test flakyness.
- name: Run logger tests
working-directory: ./logger_core
run: cargo test --all-features -- --test-threads=1
- name: Check features
working-directory: ./glide-core
run: |
cargo check --benches --all-features
cargo check --no-default-features
- uses: ./.github/workflows/test-benchmark
with:
language-flag: -rust
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./glide-core
github-token: ${{ secrets.GITHUB_TOKEN }}
name: lint glide-core
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./logger_core
github-token: ${{ secrets.GITHUB_TOKEN }}
name: lint logger
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./benchmarks/rust
github-token: ${{ secrets.GITHUB_TOKEN }}
name: lint benchmark