2828
2929# This is the list of parameters for this template and their default values.
3030parameters :
31- name : ' '
31+ os_name : ' '
3232 vm_image : ' '
33+ python_version : ' '
3334
3435jobs :
3536 # The job will be named after the OS and Azure will suffix the strategy to make it unique
3637 # so we'll have a job name "Windows Python 3.9" for example. What's a strategy? Strategies are the
3738 # name of the keys under the strategy.matrix scope. So for each OS we'll have "<OS> Python 3.9" and
3839 # "<OS> Python 3.10".
39- - job : ${{ parameters.name }}
40+ - job :
41+ displayName : " ${{ parameters.os_name }} Python ${{ parameters.python_version }}"
4042 pool :
4143 vmImage : ${{ parameters.vm_image }}
42- # The strategy is another way of removing repetition. It will create one job per entry in the
43- # matrix.
44- strategy :
45- matrix :
46- # We support these versions of Python.
47- Python 3.9 :
48- python.version : ' 3.9'
49- Python 3.10 :
50- python.version : ' 3.10'
51- Python 3.11 :
52- python.version : ' 3.11'
53-
54- maxParallel : 4
5544
5645 variables :
5746 group : sg-credentials
5847
5948 # These are the steps that will be executed inside each job.
6049 steps :
61- # Specifies which version of Python we want to use. That's where the strategy comes in.
62- # Each job will share this set of steps, but each of them will receive a different
63- # $(python.version)
50+ # Specifies which version of Python we want to use.
6451 # TODO: We should provide `githubToken` if we want to download a python release.
6552 # Otherwise we may hit the GitHub anonymous download limit.
6653 - task : UsePythonVersion@0
6754 inputs :
68- versionSpec : ' $(python.version)'
69- addToPath : True
55+ versionSpec : ${{ parameters.python_version }}
7056
7157 # Install all dependencies needed for running the tests. This command is good
7258 # for all OSes
73- - script : |
74- python -m pip install --upgrade pip setuptools wheel
75- python -m pip install -r tests/ci_requirements.txt
76- displayName: Install tools
59+ - task : Bash@3
60+ displayName : Install dependencies
61+ inputs :
62+ targetType : inline
63+ script : |
64+ pip install --upgrade pip
65+ pip install --upgrade setuptools wheel
66+ pip install --upgrade --requirement tests/ci_requirements.txt
7767
7868 # The {{}} syntax is meant for the the pre-processor of Azure pipeline. Every statement inside
7969 # a {{}} block will be evaluated and substituted before the file is parsed to create the jobs.
8070 # So here we're inserting an extra step if the template is being invoked for Windows.
81- - ${{ if eq(parameters.name , 'Windows') }} :
71+ - ${{ if eq(parameters.os_name , 'Windows') }} :
8272 # On Windows, we need to update the certificates, the cert store is missing the newer one
8373 # from Amazon like some clients experienced a while back. Who would have thought Microsoft
8474 # would have been out of date! ;)
@@ -92,10 +82,15 @@ jobs:
9282 # Runs the tests and generates test coverage. The tests results are uploaded to Azure Pipelines in the
9383 # Tests tab of the build and each test run will be named after the --test-run-title argument to pytest,
9484 # for example 'Windows - 2.7'
95- - bash : |
96- cp ./tests/example_config ./tests/config
97- pytest --durations=0 -v --cov shotgun_api3 --cov-report xml --test-run-title="${{parameters.name}}-$(python.version)"
85+ - task : Bash@3
9886 displayName : Running tests
87+ inputs :
88+ targetType : inline
89+ script : |
90+ cp ./tests/example_config ./tests/config
91+ pytest --durations=0 -v \
92+ --cov shotgun_api3 --cov-report xml \
93+ --test-run-title="${{ parameters.os_name }}-${{ parameters.python_version }}"
9994 env :
10095 # Pass the values needed to authenticate with the Flow Production Tracking site and create some entities.
10196 # Remember, on a pull request from a client or on forked repos, those variables
@@ -110,9 +105,9 @@ jobs:
110105 # build variables are available. Because of this, we need to find another way to generate a
111106 # unique login. So instead, we'll use the the name of the platform and the python version,
112107 # which should make it unique.
113- SG_HUMAN_LOGIN: $(python_api_human_login)-${{parameters.name }}-$(python.version)
108+ SG_HUMAN_LOGIN : $(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
114109 # This will give a user name like 'something macOS 2.7'
115- SG_HUMAN_NAME: $(python_api_human_name) ${{parameters.name }} $(python.version)
110+ SG_HUMAN_NAME : $(python_api_human_name) ${{ parameters.os_name }} ${{ parameters.python_version }}
116111 SG_HUMAN_PASSWORD : $(python_api_human_password)
117112 # So, first, we need to make sure that two builds running at the same time do not manipulate
118113 # the same entities, so we're sandboxing build nodes based on their name.
@@ -123,20 +118,20 @@ jobs:
123118 # Again, this would have been a lot simpler if we could simply have had a login based on the
124119 # agent name, but alas, the agent name has a space in it which needs to be replaced to something
125120 # else and string substitution can't be made on build variables, only template parameters.
126- SG_ASSET_CODE: CI-$(python_api_human_login)-${{parameters.name }}-$(python.version)
127- SG_VERSION_CODE: CI-$(python_api_human_login)-${{parameters.name }}-$(python.version)
128- SG_SHOT_CODE: CI-$(python_api_human_login)-${{parameters.name }}-$(python.version)
129- SG_TASK_CONTENT: CI-$(python_api_human_login)-${{parameters.name }}-$(python.version)
130- SG_PLAYLIST_CODE: CI-$(python_api_human_login)-${{parameters.name }}-$(python.version)
121+ SG_ASSET_CODE : CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
122+ SG_VERSION_CODE : CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
123+ SG_SHOT_CODE : CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
124+ SG_TASK_CONTENT : CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
125+ SG_PLAYLIST_CODE : CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }}
131126
132127 # Upload the code coverage result to codecov.io.
133- - ${{ if eq(parameters.name , 'Windows') }} :
128+ - ${{ if eq(parameters.os_name , 'Windows') }} :
134129 - powershell : |
135130 $ProgressPreference = 'SilentlyContinue'
136131 Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
137132 .\codecov.exe -f coverage.xml
138133 displayName: Uploading code coverage
139- - ${{ elseif eq(parameters.name , 'Linux') }} :
134+ - ${{ elseif eq(parameters.os_name , 'Linux') }} :
140135 - script : |
141136 curl -Os https://uploader.codecov.io/latest/linux/codecov
142137 chmod +x codecov
0 commit comments