Different Linux jobs mapping to Gcc versions

markfinal's Avatar

markfinal

08 Jun, 2019 05:19 PM

Hi,

I have noticed while using the Ubuntu1804 image that both Gcc 7 and Gcc 8 are installed. This is interesting for CI on my github repos, since I can use either of these. However, my test runs are long-running, so I'd split Gcc 7 and Gcc 8 into different jobs, rather than try to do it in a single Ubuntu1804 job.

After reading https://www.appveyor.com/docs/build-environment/#using-multiple-ima..., I thought I'd try this, although my .appveyor.yml does have Windows images too. This is what I tried, with the duplicate GCC_VERSION on the Ubuntu1804 image

image:
  - Ubuntu1804
  - Ubuntu
  - Visual Studio 2019 Preview
  - Visual Studio 2017
clone_depth: 10
configuration: Release
platform: AnyCPU
for:
  - matrix:
      only:
        - image: Ubuntu
    environment:
      GCC_VERSION: 5
  - matrix:
      only:
        - image: Ubuntu1804
    environment:
      GCC_VERSION: 7
      GCC_VERSION: 8
  - matrix:
      only:
        - image: Visual Studio 2017
    environment:
        VC_VERSION: 15.0
        VC_PRERELEASE_ARGS:
  - matrix:
      only:
        - image: Visual Studio 2019 Preview
    environment:
        VC_VERSION: 16
        VC_PRERELEASE_ARGS: "--VisualC.discoverprereleases"

Note that this is my normal structure, except for the duplicate GCC_VERSION environment variable under Ubuntu1804.

This fails, however, during parsing:

Error parsing appveyor.yml: (Line: 20, Col: 7, Idx: 330) - (Line: 20, Col: 18, Idx: 341): Duplicate key

Is there any way I can achieve this?
(I'm very comfortable setting up the update-alternatives scripts once I can configure the job structure of the project in AppVeyor.)

I'd really like to see a list of jobs such as

Ubuntu1804 (gcc 7)
Ubuntu1804 (gcc 8)
Ubuntu
Visual Studio 2019 Preview
Visual Studio 2017

appearing in my projects.

Many thanks,
Mark

  1. Support Staff 1 Posted by Wasa Pleshakov on 08 Jun, 2019 07:37 PM

    Wasa Pleshakov's Avatar

    I would suggest you create a matrix this way:

    environment:
      matrix:
      - job_name: Ubuntu 16 and GCC 5
        APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
      - job_name: Ubuntu 18 and GCC 7
        APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1804
      - job_name: Ubuntu 18 and GCC 8
        APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1804
      - job_name: Visual Studio 2019 Preview
        APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 Preview
      - job_name: Visual Studio 2017
        APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
    
    Here are 2 jobs with the same Ubuntu1804 image.
    And then you can specify environment variables per each job:
    for:
      - matrix:
          only:
            - job_name: Ubuntu 16 and GCC 5
        environment:
          GCC_VERSION: 5
      - matrix:
          only:
            - job_name: Ubuntu 18 and GCC 7
        environment:
          GCC_VERSION: 7
      - matrix:
          only:
            - job_name: Ubuntu 18 and GCC 8
        environment:
          GCC_VERSION: 8
      - matrix:
          only:
            - job_name: Visual Studio 2017
        environment:
            VC_VERSION: 15.0
            VC_PRERELEASE_ARGS:
      - matrix:
          only:
            - job_name: Visual Studio 2019 Preview
        environment:
            VC_VERSION: 16
            VC_PRERELEASE_ARGS: "--VisualC.discoverprereleases"
    
    Also I would suggest you to use particular ubuntu images: ubuntu1804 and ubuntu1604. Since ubuntu image is just an alias for ubuntu1604 image as a default for those who dont care about OS version. We have a plan to switch this alias to point at ubuntu1804 image.
  2. 2 Posted by markfinal on 08 Jun, 2019 07:54 PM

    markfinal's Avatar

    Thanks! That worked, once I also removed the explicit image: node too, or I got a combinational explosion of jobs.

    And thanks for the tip for the planned switch of the Ubuntu alias.

    Mark.

  3. markfinal closed this discussion on 08 Jun, 2019 07:55 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