Skip to content

Commit

Permalink
update files
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 15, 2023
1 parent 90dc1e3 commit 77a5ae4
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 0 deletions.
46 changes: 46 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
jobs:
- job: build_and_run_ut_by_linux
displayName: Build and Run Unit Test By (Ubuntu:Latest)
timeoutInMinutes: 120
pool:
vmImage: ubuntu-latest
steps:
- task: DockerCompose@0
displayName: "Deploy Docker Compose"
inputs:
action: 'Run a Docker Compose command'
containerregistrytype: 'Container Registry'
dockerComposeFile: '$(Build.SourcesDirectory)/docker-compose.yml'
dockerComposeFileArgs: |
workDirectory=$(Build.SourcesDirectory)
dockerComposeCommand: up -d
- task: UseDotNet@2
displayName: "Install .NET Core SDK"
inputs:
version: 5.0.100
- task: UseDotNet@2
displayName: "Install .NET Core SDK"
inputs:
version: 3.1.403
- script: bash scripts/build.sh
displayName: "Build"
- script: bash scripts/test.sh
displayName: "Run Unit Test"
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: ReportGenerator
inputs:
reports: "$(Build.SourcesDirectory)/test/Unit/*/TestResults/*/coverage.cobertura.xml"
targetdir: "$(Build.SourcesDirectory)/CodeCoverage"
reporttypes: "Cobertura"
assemblyfilters: "-xunit*"
- script: bash <(curl -s https://codecov.io/bash)
displayName: "Upload to codecov.io"
- task: DockerCompose@0
displayName : "Down Docker Compose"
inputs:
action: 'Run a Docker Compose command'
containerregistrytype: 'Container Registry'
dockerComposeFile: '$(Build.SourcesDirectory)/docker-compose.yml'
dockerComposeFileArgs: |
workDirectory=$(Build.SourcesDirectory)
dockerComposeCommand: down --remove-orphans
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
codecov:
notify:
after_n_builds: 1
63 changes: 63 additions & 0 deletions docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"metadata": [
{
"src": [
{
"files": [
"src/**/*.cs"
],
"exclude": [ "**/bin/**", "**/obj/**" ]
}
],
"dest": "docs/api",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"docs/ReleaseNotes.md",
"docs/articles/**.md",
"docs/articles/**/toc.yml",
"docs/api/**.md",
"docs/api/**.yml",
"docs/api/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"docs/**/images/**"
]
}
],
"overwrite": [
{
"files": [
"docs/api/*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "3.9"
services:
redis_single:
image: redis:6.0-alpine
hostname: "redis_single"
container_name: "redis_single"
volumes:
- ${workDirectory}/env/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "6379:6379"
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
redis_interceptor:
image: redis:6.0-alpine
hostname: "redis_interceptor"
container_name: "redis_interceptor"
ports:
- "6479:6379"
command: ["redis-server"]
redis_flush:
image: redis:6.0-alpine
hostname: "redis_flush"
container_name: "redis_flush"
ports:
- "6279:6379"
command: ["redis-server"]
redis_master:
image: redis:6.0-alpine
hostname: "redis_master"
container_name: "redis_master"
ports:
- 6380:6379
redis_sentinel:
image: redis:6.0-alpine
hostname: "redis_sentinel"
container_name: "redis_sentinel"
ports:
- 26379:26379
command: redis-sentinel /usr/local/etc/redis/sentinel.conf
volumes:
- ${workDirectory}/env/sentinel.conf:/usr/local/etc/redis/sentinel.conf
68 changes: 68 additions & 0 deletions env/redis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
protected-mode no
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir ./
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass 123456
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
oom-score-adj no
oom-score-adj-values 0 200 800
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
8 changes: 8 additions & 0 deletions env/sentinel.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
port 26379
dir /tmp
sentinel monitor mymaster redis_master 6379 2
sentinel auth-pass mymaster redis_pwd
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 180000
sentinel deny-scripts-reconfig yes
4 changes: 4 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
dotnet sln remove examples/*
dotnet restore -v quiet "FreeRedis.sln"
dotnet build /clp:ErrorsOnly -v quiet "FreeRedis.sln"
33 changes: 33 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

while read name _ _ _ _ ports; do
key="DOCKER_HOST_$name"
# 0.0.0.0:1234->9876/tcp,first
tempPort=$(cut -d'-' -f1 <<<"$ports")
vr="$key=$tempPort"
echo "$vr"
export "$vr"
done <<<$(docker-compose -p tomatopunk/FreeRedis ps --filter "State="up"" | awk 'FNR > 2')

#echo $(printenv DOCKER_HOST_redis_auth)
#echo $(printenv DOCKER_HOST_redis_single)

echo "setup is finished"

cd test/Unit/ || exit

for i in *.Tests; do
echo "### Executing Tests for $i:"

time dotnet test "$i" --no-build \
--collect:"XPlat Code Coverage" \
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile="examples/*" \
>/tmp/freeredis-test.log

if [[ $? -ne 0 ]]; then
echo "Test Run Failed."
cat /tmp/freeredis-test.log
exit 1
fi
echo "Test Run Successful."
done
5 changes: 5 additions & 0 deletions scripts/up_converage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

curl -s https://codecov.io/bash > codecov
chmod +x codecov
./codecov -f "$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml" -t $1

0 comments on commit 77a5ae4

Please sign in to comment.