3838 # name of the keys under the strategy.matrix scope. So for each OS we'll have "<OS> Python 3.9" and
3939 # "<OS> Python 3.10".
4040- job :
41+ strategy :
42+ parallel : 3
4143 displayName : ${{ parameters.name }}
4244 pool :
4345 vmImage : ${{ parameters.vm_image }}
@@ -63,85 +65,88 @@ jobs:
6365 inputs :
6466 targetType : inline
6567 script : |
66- pip install --upgrade pip
67- pip install --upgrade setuptools wheel
68- pip install --upgrade --requirement tests/ci_requirements.txt
68+ python --version
69+ python -c "import sys; print(sys.platform)"
6970
70- # The {{}} syntax is meant for the the pre-processor of Azure pipeline. Every statement inside
71- # a {{}} block will be evaluated and substituted before the file is parsed to create the jobs.
72- # So here we're inserting an extra step if the template is being invoked for Windows.
73- - ${{ if startsWith(parameters.vm_image, 'windows') }} :
74- # On Windows, we need to update the certificates, the cert store is missing the newer one
75- # from Amazon like some clients experienced a while back. Who would have thought Microsoft
76- # would have been out of date! ;)
77- - powershell : |
78- $cert_url = "https://www.amazontrust.com/repository/SFSRootCAG2.cer"
79- $cert_file = New-TemporaryFile
80- Invoke-WebRequest -Uri $cert_url -UseBasicParsing -OutFile $cert_file.FullName
81- Import-Certificate -FilePath $cert_file.FullName -CertStoreLocation Cert:\LocalMachine\Root
82- displayName: Updating OS Certificates
71+ # pip install --upgrade pip
72+ # pip install --upgrade setuptools wheel
73+ # pip install --upgrade --requirement tests/ci_requirements.txt
8374
84- # Runs the tests and generates test coverage. The tests results are uploaded to Azure Pipelines in the
85- # Tests tab of the build and each test run will be named after the --test-run-title argument to pytest,
86- # for example 'Windows - 2.7'
87- - task : Bash@3
88- displayName : Running tests
89- inputs :
90- targetType : inline
91- script : |
92- cp ./tests/example_config ./tests/config
93- pytest --durations=0 -v \
94- --cov shotgun_api3 --cov-report xml \
95- --test-run-title="${{parameters.name}}-${{ parameters.python_version }}"
96- env :
97- # Pass the values needed to authenticate with the Flow Production Tracking site and create some entities.
98- # Remember, on a pull request from a client or on forked repos, those variables
99- # will be empty!
100- SG_SERVER_URL : $(ci_site)
101- SG_SCRIPT_NAME : $(ci_site_script_name)
102- SG_API_KEY : $(ci_site_script_key)
103- # The unit tests manipulate the user and project during the tests, which can cause collisions,
104- # so sandbox each build variant.
105- # Ideally, we would use the agent name here. The problem is that the agent name is in a build
106- # variable, so we can't edit it's value through a ${{replace(a,b,c)}} expression, which are evaluated before
107- # build variables are available. Because of this, we need to find another way to generate a
108- # unique login. So instead, we'll use the the name of the platform and the python version,
109- # which should make it unique.
110- SG_HUMAN_LOGIN : $(python_api_human_login)-${{parameters.name}}-$(python.version)
111- # This will give a user name like 'something macOS 2.7'
112- SG_HUMAN_NAME : $(python_api_human_name) ${{parameters.name}} $(python.version)
113- SG_HUMAN_PASSWORD : $(python_api_human_password)
114- # So, first, we need to make sure that two builds running at the same time do not manipulate
115- # the same entities, so we're sandboxing build nodes based on their name.
116- SG_PROJECT_NAME : Python API CI - $(Agent.Name)
117- # The entities created and then reused between tests assume that the same user is always
118- # manipulating them. Because different builds will be assigned different agents and therefore
119- # different projects, it means each project needs to have an entity specific to a given user.
120- # Again, this would have been a lot simpler if we could simply have had a login based on the
121- # agent name, but alas, the agent name has a space in it which needs to be replaced to something
122- # else and string substitution can't be made on build variables, only template parameters.
123- SG_ASSET_CODE : CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
124- SG_VERSION_CODE : CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
125- SG_SHOT_CODE : CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
126- SG_TASK_CONTENT : CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
127- SG_PLAYLIST_CODE : CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
75+ # # The {{}} syntax is meant for the the pre-processor of Azure pipeline. Every statement inside
76+ # # a {{}} block will be evaluated and substituted before the file is parsed to create the jobs.
77+ # # So here we're inserting an extra step if the template is being invoked for Windows.
78+ # - ${{ if startsWith(parameters.vm_image, 'windows') }}:
79+ # # On Windows, we need to update the certificates, the cert store is missing the newer one
80+ # # from Amazon like some clients experienced a while back. Who would have thought Microsoft
81+ # # would have been out of date! ;)
82+ # - powershell: |
83+ # $cert_url = "https://www.amazontrust.com/repository/SFSRootCAG2.cer"
84+ # $cert_file = New-TemporaryFile
85+ # Invoke-WebRequest -Uri $cert_url -UseBasicParsing -OutFile $cert_file.FullName
86+ # Import-Certificate -FilePath $cert_file.FullName -CertStoreLocation Cert:\LocalMachine\Root
87+ # displayName: Updating OS Certificates
88+
89+ # # Runs the tests and generates test coverage. The tests results are uploaded to Azure Pipelines in the
90+ # # Tests tab of the build and each test run will be named after the --test-run-title argument to pytest,
91+ # # for example 'Windows - 2.7'
92+ # - task: Bash@3
93+ # displayName: Running tests
94+ # inputs:
95+ # targetType: inline
96+ # script: |
97+ # cp ./tests/example_config ./tests/config
98+ # pytest --durations=0 -v \
99+ # --cov shotgun_api3 --cov-report xml \
100+ # --test-run-title="${{parameters.name}}-${{ parameters.python_version }}"
101+ # env:
102+ # # Pass the values needed to authenticate with the Flow Production Tracking site and create some entities.
103+ # # Remember, on a pull request from a client or on forked repos, those variables
104+ # # will be empty!
105+ # SG_SERVER_URL: $(ci_site)
106+ # SG_SCRIPT_NAME: $(ci_site_script_name)
107+ # SG_API_KEY: $(ci_site_script_key)
108+ # # The unit tests manipulate the user and project during the tests, which can cause collisions,
109+ # # so sandbox each build variant.
110+ # # Ideally, we would use the agent name here. The problem is that the agent name is in a build
111+ # # variable, so we can't edit it's value through a ${{replace(a,b,c)}} expression, which are evaluated before
112+ # # build variables are available. Because of this, we need to find another way to generate a
113+ # # unique login. So instead, we'll use the the name of the platform and the python version,
114+ # # which should make it unique.
115+ # SG_HUMAN_LOGIN: $(python_api_human_login)-${{parameters.name}}-$(python.version)
116+ # # This will give a user name like 'something macOS 2.7'
117+ # SG_HUMAN_NAME: $(python_api_human_name) ${{parameters.name}} $(python.version)
118+ # SG_HUMAN_PASSWORD: $(python_api_human_password)
119+ # # So, first, we need to make sure that two builds running at the same time do not manipulate
120+ # # the same entities, so we're sandboxing build nodes based on their name.
121+ # SG_PROJECT_NAME: Python API CI - $(Agent.Name)
122+ # # The entities created and then reused between tests assume that the same user is always
123+ # # manipulating them. Because different builds will be assigned different agents and therefore
124+ # # different projects, it means each project needs to have an entity specific to a given user.
125+ # # Again, this would have been a lot simpler if we could simply have had a login based on the
126+ # # agent name, but alas, the agent name has a space in it which needs to be replaced to something
127+ # # else and string substitution can't be made on build variables, only template parameters.
128+ # SG_ASSET_CODE: CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
129+ # SG_VERSION_CODE: CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
130+ # SG_SHOT_CODE: CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
131+ # SG_TASK_CONTENT: CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
132+ # SG_PLAYLIST_CODE: CI-$(python_api_human_login)-${{parameters.name}}-$(python.version)
128133
129- # Upload the code coverage result to codecov.io.
130- - ${{ if startsWith(parameters.vm_image, 'windows') }} :
131- - powershell : |
132- $ProgressPreference = 'SilentlyContinue'
133- Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
134- .\codecov.exe -f coverage.xml
135- displayName: Uploading code coverage
136- - ${{ elseif startsWith(parameters.vm_image, 'macos') }} :
137- - script : |
138- curl -Os https://uploader.codecov.io/v0.7.3/macos/codecov
139- chmod +x codecov
140- ./codecov -f coverage.xml
141- displayName: Uploading code coverage
142- - ${{ else }} :
143- - script : |
144- curl -Os https://uploader.codecov.io/latest/linux/codecov
145- chmod +x codecov
146- ./codecov -f coverage.xml
147- displayName: Uploading code cover
134+ # # Upload the code coverage result to codecov.io.
135+ # - ${{ if startsWith(parameters.vm_image, 'windows') }}:
136+ # - powershell: |
137+ # $ProgressPreference = 'SilentlyContinue'
138+ # Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
139+ # .\codecov.exe -f coverage.xml
140+ # displayName: Uploading code coverage
141+ # - ${{ elseif startsWith(parameters.vm_image, 'macos') }}:
142+ # - script: |
143+ # curl -Os https://uploader.codecov.io/v0.7.3/macos/codecov
144+ # chmod +x codecov
145+ # ./codecov -f coverage.xml
146+ # displayName: Uploading code coverage
147+ # - ${{ else }}:
148+ # - script: |
149+ # curl -Os https://uploader.codecov.io/latest/linux/codecov
150+ # chmod +x codecov
151+ # ./codecov -f coverage.xml
152+ # displayName: Uploading code cover
0 commit comments