Skip to content

Instantly share code, notes, and snippets.

@FeodorFitsner
Last active February 24, 2020 17:06
Show Gist options
  • Save FeodorFitsner/ff5c34a72a42d492b900b05917c091e2 to your computer and use it in GitHub Desktop.
Save FeodorFitsner/ff5c34a72a42d492b900b05917c091e2 to your computer and use it in GitHub Desktop.
Windows after Linux chained build jobs
environment:
matrix:
# Linux job
- job_name: Linux build
appveyor_build_worker_image: ubuntu
# Windows job
- job_name: Windows build
job_depends_on: Linux build
appveyor_build_worker_image: Visual Studio 2017
matrix:
fast_finish: true
for:
-
matrix:
only:
- job_name: Linux build
build_script:
- sh: echo "Building on Linux..."
- sh: sleep 5
test: off
-
matrix:
only:
- job_name: Windows build
build_script:
- ps: Write-Host "Building on Windows..."
- ps: Start-Sleep 5
- ps: Write-Host "Deploying"
test: off
@HiImJulien
Copy link

HiImJulien commented Feb 11, 2020

Hey there!
Thanks for sharing this. It's about to make my life easier 👍

BTW, is it possible to wait for multiple jobs?
My current solution is to chain everything, although I hope there is something more elegant.

'Clumsy' solution:

      job_name: VS2019
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      PLATFORM_TOOLSET: v142
      SDK_VERSION: 10.0
    - JOB: Visual Studio 2017
      job_name: VS2017
      job_depends_on: VS2019
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
      PLATFORM_TOOLSET: v141
      SDK_VERSION: '%WindowsSDKVersion%'
    - JOB: Visual Studio 2015
      job_name: VS2015
      job_depends_on: VS2017
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
      PLATFORM_TOOLSET: v140
      SDK_VERSION: '%WindowsSDKVersion%'
    - job_name: Package
      job_depends_on: VS2015

@FeodorFitsner
Copy link
Author

Sure, you can use job_group in a job definition and then use group name as a dependency:

environment:
  matrix:

  # Linux job
  - job_name: Linux build
    job_group: build
    appveyor_build_worker_image: ubuntu
  
  # Windows job
  - job_name: Windows build
    job_group: build
    appveyor_build_worker_image: Visual Studio 2017

  # Tests
  - job_name: Tests
    job_depends_on: build
    appveyor_build_worker_image: Visual Studio 2017

matrix:
  fast_finish: true

for:
-
...

This way both "Linux build" and "Windows build" jobs will be run in parallel (if account has enough concurrent jobs) and "Tests" job after them.

@HiImJulien
Copy link

Hey, thanks for your reply!
Made my life easier 👍

Why is this not in the documentations yet, though?

@FeodorFitsner
Copy link
Author

This feature was kind of experimental, but we are definitely going to document it. Glad it worked for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment