Search code examples
redisappveyor

start redis-server on appveyor


I want to run some xUnit tests on AppVeyor that needs an available instance of redis. I didn't found Redis within the "Service" of AppVeyor so I end up with a custom solution, as you can see from the appveyor.yml

version: 1.0.{build}
before_build:
- nuget restore .\Hangfire.Redis.StackExchange.sln
- START .\packages\Redis-32.2.6.12.1\tools\redis-server.exe ".\packages\Redis-32.2.6.12.1\tools\redis.conf"
- '@ECHO Redis Started'
build:
  publish_nuget: true
  publish_nuget_symbols: true
  verbosity: minimal

unfortunately the build process stuck at START .\packages\Redis-32.2.6.12.1\tools\redis-server.exe ".\packages\Redis-32.2.6.12.1\tools\redis.conf"

any idea or possible workaround ?


Solution

  • For anyone interested, that's the appveyor.yml that did the trick. It basically download the release directly from github, unzip in a folder, install and start Redis as a service

    version: 1.0.{build}
    before_build:
    - ps: >-
        Invoke-WebRequest "https://github.com/MSOpenTech/redis/releases/download/win-2.8.17.4/redis-2.8.17.zip" -OutFile .\redis-2.8.17.zip;
    
        $destFolder = "redis-2.8.17";
    
        $shell = new-object -com shell.application;
    
    
        $zip = $shell.NameSpace("$pwd\redis-2.8.17.zip");
    
        if (Test-Path $pwd\$destFolder )
    
        {
            del $pwd\$destFolder -Force -Recurse
        }
    
        md ".\redis-2.8.17";
    
        foreach($item in $zip.items())
    
        {
            $shell.Namespace("$pwd\redis-2.8.17").copyhere($item);
        it kind of worked
    
        cd $destFolder
    
        .\redis-server.exe --service-install
    
        .\redis-server.exe --service-start
    
        cd ..
    - nuget restore Hangfire.Redis.StackExchange.sln
    build:
      publish_nuget: true
      publish_nuget_symbols: true
      verbosity: minimal