in reply to AppVeyor failing to build/test CPAN distro

What does echo C:\projects\%APPVEYOR_PROJECT_NAME% produce?

One possibility is that the CI is running under powershell, which uses a perl-like syntax for variables. The config does not specify the shell, but maybe it is in the system setup.

The cd call also might also not be needed if the system is already in the project dir. (Edited typo)

(Some of the above was cribbed from https://help.appveyor.com/discussions/problems/10635-cant-cd-to-appveyor_build_folder).

Replies are listed 'Best First'.
Re^2: AppVeyor failing to build/test CPAN distro
by jkeenan1 (Deacon) on Feb 21, 2025 at 11:44 UTC

    I don't have a terminal at which to echo that command. The only way I know how to use AppVeyor is what I'm provided with at ci.appveyor.com.

      In recent years, my windows-based test has been focused on GHActions rather than AppVeyor, but many of my older projects still have the AppVeyor setup.

      swl said,

      One possibility is that the CI is running under powershell

      As the "cribbed" source says, AppVeyor defaults to cmd for its script, and you have to prefix powershell scripts with ps: . So , since jkeenan1's cat shows no ps prefixes, I don't think that's the problem. (In the "cribbed" question, the questioner was specifically doing the cd in a - ps: cd ... command, so needed to use powershell syntax.)

      swl said,

      The cd call also might also not be needed if the system is already in the project dir.

      I just checked a handful of my .appveyor.yml files, and none of them needs a cd to properly work. So I would agree with this advice.

      However, AppVeyor's env-var docs claim that %APPVEYOR_PROJECT_NAME% is the correct name for that variable. I haven't printed that variable in a while (if ever), so I concur with swl's advice: jkeenan1 may want to echo both that variable, and I will add the suggestion for also echoing the %APPVEYOR_BUILD_FOLDER% mentioned in the "cribbed" source, because it doesn't make sense to me that the cd isn't working -- I thought momentarily that it might be because the variable value is lowercase whereas the directory might really be uppercase (or vice versa), but this is Windows, so case should be irrelevant. So even if the cd is not needed, I am still curious why it isn't working.

      jkeenan1 said,

      I don't have a terminal at which to echo that command.

      I believe you misunderstood swl's echo advice: you can add commands your your .appveyor.yml to do the echo, and then re-run the CI. Change your "install" section to:

      install: - if not exist "C:\strawberry" cinst strawberryperl - set PATH=C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\str +awberry\c\bin;%PATH% - echo cd C:\projects\%APPVEYOR_PROJECT_NAME% - echo %APPVEYOR_BUILD_FOLDER% - echo %CD% - cpanm --installdeps .

      I think this will do two things: 1) assuming that the echo commands don't cause the "install" step to fail, it should show that the cd isn't needed, since my version of the "install" step doesn't actually execute the cd, and (2) it will show the current values of those environment variables, if it's needed for future debugging.


      update: I tried an .appveyor.yml that includes those three echoes I showed (among other things), with the AppVeyor results showing that echoing C:\projects\%APPVEYOR_PROJECT_NAME% and %APPVEYOR_BUILD_FOLDER% and %CD% all give the same value for my repository ("avtest") . So, unless jkeenan1 has something weird in the project name, I see no reason why the cd wouldn't've worked, which is exceedingly confusing to me.
      Environment Vars (like PATH) have changed. Close/reopen your shell to
      see the changes (or in powershell/cmd.exe just type `refreshenv`).


      AIUI, APPVEYOR_PROJECT_NAME is an "Environment Var".
      Is there anything in the outputs (to which you have access) that indicates what APPVEYOR_PROJECT_NAME has been set to ?

      Cheers,
      Rob