Кэширование зависимостей Python Playwright в Azure PipelinesPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Кэширование зависимостей Python Playwright в Azure Pipelines

Сообщение Anonymous »

У меня есть платформа автоматизации playwrite/python, и я пытаюсь настроить файл yaml. Однако мне не везет. Моя цель — создать этап для установки всех зависимостей, а затем использовать этот этап в качестве зависимости для любого этапа, который я буду создавать.
Вот мой текущий код. Никаких ошибок нет, но не похоже, что он устанавливает указанные зависимости и запускает тест на этапах.

Код: Выделить всё

trigger:
branches:
include:
- main  # Adjust the branch name as needed

pool:
vmImage: 'windows-latest'  # Same VM image for all stages

stages:
- stage: InstallDependencies
displayName: "Install Dependencies"
jobs:
- job: Install
displayName: "Install Dependencies"
steps:
# Use the same Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'  # Adjust according to your Python version requirements
addToPath: true

# Set up the virtual environment and install dependencies
- script: |
python -m venv .venv
.venv\Scripts\activate
python.exe -m pip install --upgrade pip
python.exe -m pip install behave
python.exe -m pip install -r requirements.txt
python -m playwright install
displayName: "Set up Python Virtual Environment and Install Dependencies"

# Publish the virtual environment as an artifact
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '.venv'  # Path to the virtual environment
ArtifactName: 'venv'   # Artifact name
publishLocation: 'Container'

# Run Inventory Feature Tests
- stage: InventoryFeature
dependsOn: InstallDependencies
displayName: "Run Inventory Feature Tests"
jobs:
- job: RunInventory
displayName: "Run Inventory Feature Tests"
steps:
# Use the same Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true

# Download the virtual environment artifact
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'venv'
downloadPath: '$(System.DefaultWorkingDirectory)'

# Activate the virtual environment and run tests
- script: |
$(System.DefaultWorkingDirectory)\venv\Scripts\activate
behave features/inventory.feature --junit --junit-directory reports/inventory
displayName: "Run Inventory Feature Tests"

# Publish test results
- task: PublishTestResults@2
inputs:
testResultsFiles: 'reports/inventory/*.xml'
testRunTitle: "Inventory Feature Tests"

# Run Stores Feature Tests
- stage: StoresFeature
dependsOn: InstallDependencies
displayName: "Run Stores Feature Tests"
jobs:
- job: RunStores
displayName: "Run Stores Feature Tests"
steps:
# Use the same Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true

# Download the virtual environment artifact
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'venv'
downloadPath: '$(System.DefaultWorkingDirectory)'

# Activate the virtual environment and run tests
- script: |
$(System.DefaultWorkingDirectory)\venv\Scripts\activate
behave features/stores.feature --junit --junit-directory reports/stores
displayName: "Run Stores Feature Tests"

# Publish test results
- task: PublishTestResults@2
inputs:
testResultsFiles: 'reports/stores/*.xml'
testRunTitle: "Stores Feature Tests"

# Run Colors Feature Tests
- stage: ColorsFeature
dependsOn: InstallDependencies
displayName: "Run Colors Feature Tests"
jobs:
- job: RunColors
displayName: "Run Colors Feature Tests"
steps:
# Use the same Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true

# Download the virtual environment artifact
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'venv'
downloadPath:  '$(System.DefaultWorkingDirectory)'

# Activate the virtual environment and run tests
- script: |
$(System.DefaultWorkingDirectory)\venv\Scripts\activate
behave features/colors.feature --junit --junit-directory reports/colors
displayName: "Run Colors Feature Tests"

# Publish test results
- task: PublishTestResults@2
inputs:
testResultsFiles: 'reports/colors/*.xml'
testRunTitle: "Colors Feature Tests"
или есть ли у кого-нибудь лучшее предложение для достижения той же цели? признателен за любые рекомендации.


Подробнее здесь: https://stackoverflow.com/questions/793 ... -pipelines
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Как связать результаты BrowserStack (автоматизация приложений) и Azure Devops Pipelines для Android
    Anonymous » » в форуме Android
    0 Ответы
    21 Просмотры
    Последнее сообщение Anonymous
  • Azure DevOps Pipelines XCode 16.0 не может найти утилиту «acttool»
    Anonymous » » в форуме IOS
    0 Ответы
    16 Просмотры
    Последнее сообщение Anonymous
  • Azure DevOps Pipelines XCode 16.0 не может найти утилиту «acttool»
    Anonymous » » в форуме IOS
    0 Ответы
    27 Просмотры
    Последнее сообщение Anonymous
  • Как кэшировать пакеты pip в Azure Pipelines
    Anonymous » » в форуме Python
    0 Ответы
    18 Просмотры
    Последнее сообщение Anonymous
  • Как обновить Android cmdline-tools на агенте macOS в Azure Pipelines
    Anonymous » » в форуме JAVA
    0 Ответы
    0 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»