Multi-platform Nuget Packing

Paolo's Avatar

Paolo

26 Nov, 2018 10:48 AM

Hello,
I'm new to appveyor and not sure I understand that whole matrix system correctly, but as it seems to me it's impossible to have aggregate build results of several jobs for multiple platforms and toolsets. Can anyone confirm this ?
What I wanted to achieve is generating a Nuget for a C++ Windows library that should contain binaries compiled for Visual Studio 2013, 2015 and 2017, each of which in x86 and x64. Any way to do this ?

  1. Support Staff 1 Posted by Owen McDonnell on 26 Nov, 2018 04:06 PM

    Owen McDonnell's Avatar

    I'm not sure exactly what you mean by 'aggregate build results' but if you are publishing nuget packages from a project with multiple jobs, this section of the docs may be relevant to you.

  2. 2 Posted by paolo20000 on 27 Nov, 2018 09:06 AM

    paolo20000's Avatar

    Thanks for your reply.
    I saw that section and it seems Appveyor makes it quite easy to publish Nugets.
    But doesn't that generate one Nuget per job ? In my case I'm afraid I'd end up with as many as 6 packages ( [2013,2015,2017] x [x86,x64] ) while everything could be contained in only one Nuget.
    That's what I meant with aggregate the build results, merging the binaries compiled by several jobs into one package.

  3. Support Staff 3 Posted by Owen McDonnell on 28 Nov, 2018 01:26 AM

    Owen McDonnell's Avatar

    My colleague created this script which could be used in this situation.
    I've adapted it a little below. Of course, the timeout is not really necessary if you prefer to just have maximum build time be the timeout. Also, note that the APPVEYOR_BUILD_NUMBER would need to change if you add any jobs to the matrix.

    image:
      - Visual Studio 2017
      - Visual Studio 2015
      - Visual Studio 2013
    platform:
      - x86
      - x64
    environment:
      ApiKey:
        secure: SlDEDtAKuvsy+VErEuc/4DxdhPeKu2WRqvYzEh/fiH4=
      TimeOutMins: 20
    
    after_build:
      - <your-packaging-scripts>
      - ps: |
          if ($env:APPVEYOR_JOB_NUMBER -eq 6) {  
            $headers = @{
                "Authorization" = "Bearer $ApiKey"
                "Content-type" = "application/json"
            }
           
            [datetime]$stop = ([datetime]::Now).AddMinutes($env:TimeOutMins)
            [bool]$success = $false  
        
            while(!$success -and ([datetime]::Now) -lt $stop) {
                $project = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Headers $headers -Method GET 
                foreach ($job in $project.build.jobs) {
                  if ($job.status -eq "success") {continue}
                }
               $success = $true    
            }
        
            if (!$success) {throw "Jobs were not finished in $env:TimeOutMins minutes"}
            foreach ($job in $filteredJobs) {
              Start-FileDownload  https://ci.appveyor.com/api/buildjobs/$job.jobId/artifacts/<your-build-artifact> <artifact-name>
            }
          }
    
  4. Ilya Finkelshteyn closed this discussion on 28 Jan, 2019 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

 

21 Mar, 2019 05:38 PM
21 Mar, 2019 06:16 AM
21 Mar, 2019 01:47 AM
20 Mar, 2019 11:39 PM
20 Mar, 2019 09:03 PM
20 Mar, 2019 08:55 PM