Skip to content

Commit

Permalink
[azure-pipelines] matrix pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed May 13, 2020
1 parent fd5fd83 commit cf5935f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 43 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

## Azure Pipelines

there are 4 pipelines, 1 for each OS and one dedicated to "Analysis".
there are 5 pipelines, 1 for each OS and one dedicated to "Analysis", plus 1 for matrix build.

- the CI pipelines related to each os are building multiple time based on the below matrix.
The result of the tests are publish in Azure Devops as well through `ctest -T Test` flag.
- the Analysis pipeline is analyzing the code, generating coverage and publish to codecov and SonarCloud
- the Matrix pipeline is an overkill so it is just triggered manually when required.


The build is reflecting this matrix:
The Matrix build is reflecting this table:

| FLAGS\OS | Windows | Linux | macos |
|:--------------------:|:------------------:|:------------------:|:------------------:|
Expand Down
79 changes: 49 additions & 30 deletions azure-pipelines/matrix.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
trigger:
branches:
include:
- master
paths:
exclude:
#- .gitignore
- .github/*
- README.md
- appveyor.yml
tags:
include:
- '*'
### Trigger only on tags or on github pre-release and make the other depending on this one?
### this is succeful by default if not running..

pr:
branches:
include:
- master
paths:
exclude:
#- .gitignore
- .github/*
- README.md
- appveyor.yml
- LICENSE
# trigger:
# branches:
# include:
# - master
# paths:
# exclude:
# #- .gitignore
# - .github/*
# - README.md
# - appveyor.yml
# tags:
# include:
# - '*'

# pr:
# branches:
# include:
# - master
# paths:
# exclude:
# #- .gitignore
# - .github/*
# - README.md
# - appveyor.yml
# - LICENSE

trigger: none
pr: none

variables:
- template: variables/global.yml
Expand All @@ -42,7 +48,7 @@ stages:
vmImageName: ${{ variables.windows_image }}
triplet: x64-windows
macos:
vmImageName: ${{ variables.macos_image }}
vmImageName: ${{ variables.mac_image }}
triplet: x64-osx
pool:
vmImage: $(vmImageName)
Expand All @@ -52,24 +58,37 @@ stages:
vcpkg_key_cache: $(CACHE_VCPKG_KEY)
triplet: $(triplet)

- stage: Build Matrix
### split in stages for each OS depending on stage dep
- stage: matrix_linux
displayName: Matrix Linux
dependsOn: Dep
jobs:
- template: 'templates/matrix-job.yml'
parameters:
jobDisplayName: "linux"
jobName: "linux"
vmImageName: ${{ variables.linux_image }}
triplet: x64-linux
sdl2_static: ['ON']
enable_code_coverage: ['OFF']
- stage: matrix_windows
displayName: Matrix Windows
dependsOn: Dep
jobs:
- template: 'templates/matrix-job.yml'
parameters:
jobDisplayName: "windows"
jobName: "windows"
vmImageName: ${{ variables.windows_image }}
triplet: x64-windows
arch: 64
enable_code_coverage: ['OFF']
cmake_ignore_path: $(CMAKE_IGNORE_PATH_WIN)
- stage: matrix_macos
displayName: Matrix MacOS
dependsOn: Dep
jobs:
- template: 'templates/matrix-job.yml'
parameters:
jobDisplayName: "macos"
vmImageName: ${{ variables.macos_image }}
jobName: "macos"
vmImageName: ${{ variables.mac_image }}
triplet: x64-osx
sdl2_static: ['ON']
24 changes: 14 additions & 10 deletions azure-pipelines/templates/matrix-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ parameters:
enable_code_coverage: ['ON', 'OFF']
vmImageName: ''
triplet: ''
jobDisplayName: 'Build Matrix'
jobName: 'build_matrix'
arch: ''
cmake_ignore_path: ''

jobs:
- job: build_matrix
displayName: ${{ parameters.jobDisplayName }}
- job: ${{ parameters.jobName }}
#displayName: ${{ parameters.jobDisplayName }}
strategy:
matrix:
${{ each configuration in parameters.configuration }}:
Expand All @@ -23,13 +25,13 @@ jobs:
${{ each build_snapshot in parameters.build_snapshot}}:
${{ each enable_code_coverage in parameters.enable_code_coverage}}:
${{ format('{0}-{1}-{2}-{3}-{4}-{5}-{6}', configuration, sdl2_static, build_testing, build_shared_libs, build_examples, build_snapshot, enable_code_coverage) }}:
CONFIGURATION: ${{ configuration }}
SDL2_STATIC: ${{ sdl2_static }}
BUILD_TESTING: ${{ build_testing }}
BUILD_SHARED_LIBS: ${{ build_shared_libs }}
BUILD_EXAMPLES: ${{ build_examples }}
BUILD_SNAPSHOT: ${{ build_snapshot }}
ENABLE_CODE_COVERAGE: ${{ enable_code_coverage }}
CONFIGURATION: ${{ configuration }}
SDL2_STATIC: ${{ sdl2_static }}
BUILD_TESTING: ${{ build_testing }}
BUILD_SHARED_LIBS: ${{ build_shared_libs }}
BUILD_EXAMPLES: ${{ build_examples }}
BUILD_SNAPSHOT: ${{ build_snapshot }}
ENABLE_CODE_COVERAGE: ${{ enable_code_coverage }}
pool:
vmImage: ${{ parameters.vmImageName }}
steps:
Expand All @@ -38,6 +40,8 @@ jobs:
vcpkg_key_cache: $(CACHE_VCPKG_KEY)
triplet: ${{ parameters.triplet }}
build_type: $(CONFIGURATION)
arch: ${{ parameters.arch }}
cmake_ignore_path: ${{ parameters.cmake_ignore_path }}
test: false
install: false
package: false

0 comments on commit cf5935f

Please sign in to comment.