forked from Azure/PyRIT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-tests.yml
More file actions
67 lines (63 loc) · 2.13 KB
/
integration-tests.yml
File metadata and controls
67 lines (63 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Builds the pyrit environment and runs integration tests
trigger:
- main
# There are additional PR triggers for this that are configurable in ADO.
jobs:
- job: IntegrationTests
displayName: "Builds the pyrit environment and runs integration tests"
timeoutInMinutes: 360 # Allows the job to run up to 6 hours
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
addToPath: true
- task: AzureKeyVault@2
displayName: Azure Key Vault - retrieve .env file secret
inputs:
azureSubscription: 'integration-test-service-connection'
KeyVaultName: 'pyrit-environment'
SecretsFilter: 'env-global'
RunAsPreJob: false
- bash: |
python -c "
import os;
secret = os.environ.get('PYRIT_TEST_SECRET');
if not secret:
raise ValueError('PYRIT_TEST_SECRET is not set');
with open('.env', 'w') as file:
file.write(secret)"
env:
PYRIT_TEST_SECRET: $(env-global)
name: create_env_file
- bash: |
cp build_scripts/env_local_integration_test .env.local
displayName: "Create .env.local from example"
- bash: pip install --upgrade setuptools pip packaging
name: upgrade_pip_and_setuptools_before_installing_PyRIT
- bash: sudo apt-get install python3-tk
name: install_tkinter
- bash: pip install .[dev,all] -v
name: install_PyRIT
# This step ensures that integration tests are run outside of the PyRIT repository to test that .env files are accessed correctly.
- bash: |
PyRIT_DIR=$(pwd)
NEW_DIR="integration_test_directory"
cd ..
mkdir -p $NEW_DIR/tests
cp $PyRIT_DIR/.env $NEW_DIR
cp $PyRIT_DIR/.env.local $NEW_DIR
cp -r $PyRIT_DIR/doc $NEW_DIR
cp -r $PyRIT_DIR/assets $NEW_DIR
cp -r $PyRIT_DIR/tests/integration $NEW_DIR/tests
cd $NEW_DIR
displayName: "Create and switch to new integration test directory"
- bash: make integration-test
name: run_integration_tests
- bash: rm -f .env
name: clean_up_env_file
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit/test-results.xml'