Skip to content

Commit f1a7964

Browse files
Migrate CI workflows (#8)
* Migrate CI workflows Signed-off-by: Yury-Fridlyand <[email protected]>
1 parent dc4c177 commit f1a7964

File tree

19 files changed

+901
-1
lines changed

19 files changed

+901
-1
lines changed

.github/codeql/codeql-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
paths-ignore:
2+
- "examples/**"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "dependabot-management-workflow",
3+
"version": "1.0.0",
4+
"description": "Dependencies for the dependabot management workflow",
5+
"dependencies": {
6+
"@octokit/rest": "20.0.2",
7+
"semver": "7.5.4"
8+
}
9+
}

.github/dependabot.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: 2
2+
3+
updates:
4+
# Enable version updates for NuGet (C#)
5+
- package-ecosystem: "nuget"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "monday"
10+
time: "09:00"
11+
open-pull-requests-limit: 10
12+
groups:
13+
patch-updates:
14+
update-types:
15+
- "patch"
16+
minor-updates:
17+
update-types:
18+
- "minor"
19+
labels:
20+
- "dependencies"
21+
- "nuget"
22+
- "csharp"
23+
24+
# Enable version updates for GitHub Actions
25+
- package-ecosystem: "github-actions"
26+
directory: "/"
27+
schedule:
28+
interval: "weekly"
29+
day: "monday"
30+
time: "09:00"
31+
open-pull-requests-limit: 5
32+
groups:
33+
patch-updates:
34+
update-types:
35+
- "patch"
36+
minor-updates:
37+
update-types:
38+
- "minor"
39+
labels:
40+
- "dependencies"
41+
- "github-actions"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"OS": "ubuntu",
4+
"NAMED_OS": "linux",
5+
"RUNNER": "ubuntu-24.04",
6+
"ARCH": "x64",
7+
"TARGET": "x86_64-unknown-linux-gnu",
8+
"run": "always"
9+
},
10+
{
11+
"OS": "ubuntu",
12+
"NAMED_OS": "linux",
13+
"RUNNER": "ubuntu-24.04-arm",
14+
"ARCH": "arm64",
15+
"TARGET": "aarch64-unknown-linux-gnu"
16+
},
17+
{
18+
"OS": "macos",
19+
"NAMED_OS": "darwin",
20+
"RUNNER": "macos-15",
21+
"ARCH": "arm64",
22+
"TARGET": "aarch64-apple-darwin"
23+
},
24+
{
25+
"OS": "macos",
26+
"NAMED_OS": "darwin",
27+
"RUNNER": "macos-13",
28+
"ARCH": "x64",
29+
"TARGET": "x86_64-apple-darwin"
30+
},
31+
{
32+
"OS": "amazon-linux",
33+
"NAMED_OS": "linux",
34+
"RUNNER": "ubuntu-latest",
35+
"ARCH": "x64",
36+
"TARGET": "x86_64-unknown-linux-gnu",
37+
"IMAGE": "amazonlinux:latest"
38+
}
39+
]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"type": "valkey",
4+
"version": "8.1",
5+
"run": "always"
6+
},
7+
{
8+
"type": "valkey",
9+
"version": "8.0"
10+
},
11+
{
12+
"type": "valkey",
13+
"version": "7.2"
14+
},
15+
{
16+
"type": "redis",
17+
"version": "7.0"
18+
},
19+
{
20+
"type": "redis",
21+
"version": "6.2",
22+
"run": "always"
23+
}
24+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"versions": ["8.0", "6.0"],
3+
"always-run-versions": ["8.0"]
4+
}

.github/workflows/codeql.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "v.?[0-9]+.[0-9]+.[0-9]+"
8+
- "v.?[0-9]+.[0-9]+"
9+
- "v?[0-9]+.[0-9]+.[0-9]+"
10+
- "v?[0-9]+.[0-9]+"
11+
- release-*
12+
pull_request:
13+
branches:
14+
- "main"
15+
- "v.?[0-9]+.[0-9]+.[0-9]+"
16+
- "v.?[0-9]+.[0-9]+"
17+
- "v?[0-9]+.[0-9]+.[0-9]+"
18+
- "v?[0-9]+.[0-9]+"
19+
- release-*
20+
schedule:
21+
- cron: "37 18 * * 6"
22+
workflow_dispatch:
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
permissions:
29+
security-events: write
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@v3
38+
with:
39+
languages: csharp
40+
build-mode: manual
41+
42+
# C# Build
43+
- name: Setup .NET
44+
uses: actions/setup-dotnet@v4
45+
with:
46+
dotnet-version: "8.0.x"
47+
48+
- name: Build the client
49+
shell: bash
50+
run: dotnet build sources/Valkey.Glide/Valkey.Glide.csproj --configuration Lint --framework net8.0
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@v3
54+
with:
55+
category: "/language:csharp"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
inputs:
2+
run-full-matrix:
3+
description: "Run the full matrix"
4+
required: true
5+
type: boolean
6+
containers:
7+
description: "Run in containers"
8+
required: true
9+
default: false
10+
type: boolean
11+
12+
outputs:
13+
server-matrix-output:
14+
description: "Server matrix"
15+
value: ${{ steps.load-server-matrix.outputs.server-matrix }}
16+
os-matrix-output:
17+
description: "OS matrix"
18+
value: ${{ steps.load-os-matrix.outputs.os-matrix }}
19+
version-matrix-output:
20+
description: "Version matrix"
21+
value: ${{ steps.create-lang-version-matrix.outputs.version-matrix }}
22+
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: "Setup Environment Variables"
27+
shell: bash
28+
env:
29+
RUN_FULL_MATRIX: ${{ inputs.run-full-matrix }}
30+
CONTAINERS: ${{ inputs.containers }}
31+
run: |
32+
echo "RUN_FULL_MATRIX=$RUN_FULL_MATRIX" >> $GITHUB_ENV
33+
echo "CONTAINERS=$CONTAINERS" >> $GITHUB_ENV
34+
35+
- name: Load server matrix
36+
id: load-server-matrix
37+
shell: bash
38+
working-directory: .github/json_matrices
39+
run: |
40+
set -o pipefail
41+
echo 'Select server versions to run tests against'
42+
if [[ "$RUN_FULL_MATRIX" == "true" ]]; then
43+
echo 'Pick all server versions - on cron (schedule) or if manually triggered job requires a full matrix'
44+
jq -c . < server-matrix.json | awk '{ printf "server-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
45+
else
46+
echo 'Pick server versions marked as `"run": "always"` only - on PR, push or manually triggered job which does not require full matrix'
47+
jq -c '[.[] | select(.run == "always")]' < server-matrix.json | awk '{ printf "server-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
48+
fi
49+
50+
- name: Load os matrix
51+
id: load-os-matrix
52+
shell: bash
53+
working-directory: .github/json_matrices
54+
run: |
55+
set -o pipefail
56+
[[ "$CONTAINERS" == "true" ]] && CONDITION=".IMAGE?" || CONDITION=".IMAGE == null"
57+
echo 'Select runners (VMs) to run tests on'
58+
if [[ "$RUN_FULL_MATRIX" == "true" ]]; then
59+
echo 'Pick all runners - on cron (schedule) or if manually triggered job requires a full matrix'
60+
jq -c "[.[] | select($CONDITION)]" < os-matrix.json | awk '{ printf "os-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
61+
else
62+
echo 'Pick runners marked as '"run": "always"' only - on PR, push or manually triggered job which does not require full matrix'
63+
jq -c '[.[] | select(.run == "always")]' < os-matrix.json | awk '{ printf "os-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
64+
fi
65+
66+
- name: Create language version matrix
67+
id: create-lang-version-matrix
68+
shell: bash
69+
working-directory: .github/json_matrices
70+
run: |
71+
set -o pipefail
72+
echo 'Select language (framework/SDK) versions to run tests on'
73+
if [[ "$RUN_FULL_MATRIX" == "true" ]]; then
74+
echo 'Pick language versions listed in 'versions' - on cron (schedule) or if manually triggered job requires a full matrix'
75+
jq -c ".versions" < version-matrix.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
76+
else
77+
echo 'Pick language versions listed in 'always-run-versions' only - on PR, push or manually triggered job which does not require full matrix'
78+
jq -c ".\"always-run-versions\"" < version-matrix.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
79+
fi
80+
81+
- name: Validate no empty/incorrect matrices
82+
shell: bash
83+
run: |
84+
SERVERS=`jq length <<< '${{ steps.load-server-matrix.outputs.server-matrix }}'`
85+
if [[ $SERVERS == 0 ]]; then
86+
echo "Server version matrix is empty!"
87+
exit 1
88+
fi
89+
HOSTS=`jq length <<< '${{ steps.load-os-matrix.outputs.os-matrix }}'`
90+
if [[ $HOSTS == 0 ]]; then
91+
echo "OS matrix is empty!"
92+
exit 1
93+
fi
94+
LANGS=`jq length <<< '${{ steps.create-lang-version-matrix.outputs.version-matrix }}'`
95+
if [[ $LANGS == 0 ]]; then
96+
echo "Dotnet version matrix is empty!"
97+
exit 1
98+
fi
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Install Rust tool chain
2+
3+
inputs:
4+
target:
5+
description: "Specified target for rust toolchain, ex. x86_64-apple-darwin"
6+
type: string
7+
required: false
8+
github-token:
9+
description: "GitHub token"
10+
type: string
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Install Rust toolchain
17+
uses: dtolnay/rust-toolchain@stable
18+
with:
19+
targets: ${{ inputs.target }}

0 commit comments

Comments
 (0)