Search code examples
rgitgithubyamlappveyor

Check multiple subdirectories using AppVeyor


I have a project with multiple subdirectories which I all want to check in turn. Actually, these directories are a bit outdated version of branches which I have to keep for various reasons.

In my main folder I have the subdirectories patch and pkg and want to check both. I tried to use the following script to achieve this.

environment:
  matrix:
  - TEST_DIR: patch/
  - TEST_DIR: pkg/

before_build:
  - ps: echo %TEST_DIR%
  - ps: cd %TEST_DIR%

build_script:
  - travis-tool.sh install_deps

I also used $TEST_DIR and also had the lines

  - ps: echo %TEST_DIR%
  - ps: cd %TEST_DIR%

in build_script just before - travis-tool.sh install_deps. None of this was working.

When I use echo %TEST_DIR% it echos %TEST_DIR% and with echo $TEST_DIR nothing is echoed, i.e., the string seems to be empty. Any clues?


In Travis-CI I can use

## test multiple directories 
## (see https://lord.io/blog/2014/travis-multiple-subdirs/)
env:
 - TEST_DIR=patch/
 - TEST_DIR=pkg/

language: r
sudo: required

## change directory before installation 
## as R packages are not available elsewise
before_install:
  - cd $TEST_DIR

which works like a charm.


Solution

  • After discussions with the AppVeyor support I found a valid solution for the problem:

    environment:
      matrix:
      - TEST_DIR: patch
      - TEST_DIR: pkg
    
    before_build:
      - cd %TEST_DIR%
    

    So, I simply needed to drop the console type (ps or cmd) to make it possible to change directories.

    In my case, building and checking an R project, I additionally needed to add some lines to copy scripts etc. to my before_build. All together, before_build should thus look like:

    before_build:
      - cp ..\travis-tool.sh .\travis-tool.sh
      - cp travis-tool.sh.cmd %TEST_DIR%\travis-tool.sh.cmd
      - cd %TEST_DIR%
      - bash -c "echo '^travis-tool\.sh\.cmd$' >> .Rbuildignore"
    

    Now, AppVeyor can be used as usually with the scripts supplied by the github project R+AppVeyor.