Skip to content

Commit

Permalink
cache glass binaries (#8107) (#8108)
Browse files Browse the repository at this point in the history
* cache glass binaries (#8107)

* just cache $(Build.SourcesDirectory)\GlassTests

* add a variable to skip glassCache

* change variabel to param

* run glass tests if we are manually trying to clear cache

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* fix param

* try to fix param

* try to use varaiable

* try to fix condition

* try to fix condition

* fix condition

* fix cache name

* change skipcache logic

* add missing bracket
  • Loading branch information
bschnurr authored Dec 13, 2024
1 parent 732d605 commit c5fb841
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Build/templates/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
- name: skipGlassCache
type: boolean
default: false

steps:
# Install different python versions
- template: ./install_python.yml
Expand Down Expand Up @@ -55,8 +60,17 @@ steps:
configuration: $(BuildConfiguration)
msbuildArguments: '/p:VSTarget=$(VSTarget) /bl:$(Build.SourcesDirectory)\logs\BuildProduct.binlog'

- task: CacheBeta@2
displayName: 'Restore glass binaries from cache'
condition: eq('${{ parameters.skipGlassCache }}', 'false')
inputs:
key: 'glass'
path: '$(Build.SourcesDirectory)\GlassTests'
cacheHitVar: 'CACHE_RESTORED'

- task: AzureCLI@2
displayName: 'Acquire an AAD token from a User-Assigned Managed Identity and save it as secret variable DropToken'
condition: and(succeeded(), or(eq(variables['CACHE_RESTORED'], 'false'), eq('${{ parameters.skipGlassCache }}', 'true')))
inputs:
azureSubscription: 'PylanceSecureVsIdePublishWithManagedIdentity'
scriptType: 'pscore'
Expand All @@ -72,6 +86,7 @@ steps:
# Setup the glass test folder
- task: PythonScript@0
displayName: 'Setup glass test folder'
condition: and(succeeded(), or(eq(variables['CACHE_RESTORED'], 'false'), eq('${{ parameters.skipGlassCache }}', 'true')))
env:
SYSTEM_ACCESSTOKEN: $(DropToken)
inputs:
Expand Down Expand Up @@ -102,3 +117,10 @@ steps:
testRunTitle: 'Glass Tests'
testResultsFormat: 'VSTest'
failTaskOnFailedTests: true

- task: CacheBeta@2
displayName: 'Cache glass binaries'
condition: and(succeeded(), or(eq(variables['CACHE_RESTORED'], 'false'), eq('${{ parameters.skipGlassCache }}', 'true')))
inputs:
key: 'glass'
path: '$(Build.SourcesDirectory)\GlassTests'
13 changes: 11 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ parameters:
displayName: Debugpy Version
type: string
default: latest
- name: skipGlassCache
displayName: Skip Glass Cache
type: boolean
default: false

# build number format
name: $(date:yy)$(DayOfYear)$(rev:.r)
Expand Down Expand Up @@ -78,6 +82,8 @@ variables:
value: false
- name: Packaging.EnableSBOMSigning
value: false # disabled for now because of known issue
- name: SkipGlassCache
value: ${{ parameters.skipGlassCache }}

# If the build ran because of a nightly schedule, force pylance release type to preview
- name: pylanceReleaseTypeVar
Expand Down Expand Up @@ -208,12 +214,15 @@ extends:
# Publish test data
- template: /Build/templates/publish_test_data.yml@self

# Run tests on mixed mode debugger but only for PR builds
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
# Run tests on mixed mode debugger but only for PR builds
- ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(variables['SkipGlassCache'], true)) }}:
- job: test
displayName: Test
steps:
- template: /Build/templates/run_tests.yml@self
parameters:
skipGlassCache: ${{ parameters.skipGlassCache }}




0 comments on commit c5fb841

Please sign in to comment.