Build process doesn't have access to modified PATH

pzixel's Avatar

pzixel

04 Sep, 2018 10:59 AM

I'm trying to test some codegen solution which uses external tool to build (solc in my case). It work like a charm locally, but when I'm trying to setup the build process it really doesn't.

I have following install section

install:
  - mkdir C:\Solidity
  - ps: Invoke-WebRequest https://github.com/ethereum/solidity/releases/download/v0.4.24/solidity-windows.zip -OutFile C:\Solidity\solc.zip
  - 7z e C:\Solidity\solc.zip
  - SET PATH=C:\Solidity;%PATH%
  - solc --version

It works fine and output the correct version, so I see that PATH was modified successfully and it should be globally available.

Then I'm running the build which fails because of following guard check:

var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = "solc",
        Arguments = "--version",
        UseShellExecute = false,
        RedirectStandardOutput = true,
        CreateNoWindow = true
    }
};
try
{
    process.Start();
}
catch
{
    throw new InvalidOperationException("System doesn't have solc available in PATH.");
}

How could I make this exe be available when solution is building?

Here is example of failed build: https://ci.appveyor.com/project/Pzixel/solidity-roslyn/build/0.1.6

  1. Support Staff 1 Posted by Owen McDonnell on 04 Sep, 2018 10:34 PM

    Owen McDonnell's Avatar

    Setting the path that way only works for that session. To set in on the machine level try

    - ps: [Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\Solidity", "Machine")
    
    in place of the SET PATH command you now have.
  2. 2 Posted by pzixel on 05 Sep, 2018 10:53 AM

    pzixel's Avatar
    1. This code doesn't work because it leads to YML parsing error (see https://ci.appveyor.com/project/Pzixel/solidity-roslyn/build/1.0.17 )
    2. If I move it to the powershell script it still not work (see https://ci.appveyor.com/project/Pzixel/solidity-roslyn/build/0.1.18 )
  3. Support Staff 3 Posted by Owen McDonnell on 05 Sep, 2018 05:04 PM

    Owen McDonnell's Avatar

    Can you try adding this to the top of your appveyor.yml install: section

      - ps: |
          [Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\Solidity", "Machine")
      - ps: Restart-Computer
      - ps: Start-Sleep -s 10
    
  4. 4 Posted by pzixel on 07 Sep, 2018 09:23 AM

    pzixel's Avatar
  5. Support Staff 5 Posted by Owen McDonnell on 07 Sep, 2018 04:46 PM

    Owen McDonnell's Avatar

    Can you try also adding start-sleep before restart

     - ps: |
          [Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\Solidity", "Machine")
      - ps: Start-Sleep -s 10
      - ps: Restart-Computer
      - ps: Start-Sleep -s 10
    
  6. 6 Posted by pzixel on 09 Sep, 2018 08:07 PM

    pzixel's Avatar

    Build hangs after reboot anyway.

  7. Support Staff 7 Posted by Owen McDonnell on 10 Sep, 2018 06:04 AM

    Owen McDonnell's Avatar

    Can you share some more details (configuration file, build log, etc.)?
    Below are three builds in which I had no trouble restarting the build machine.
    https://ci.appveyor.com/project/britzkopf/projecta/build/1.0.157
    https://ci.appveyor.com/project/britzkopf/projecta/build/1.0.158
    https://ci.appveyor.com/project/britzkopf/projecta/build/1.0.159

  8. Ilya Finkelshteyn closed this discussion on 10 Nov, 2018 09:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac