Skip to content

Commit

Permalink
[CI] Move 2, 3: Copy job SourceTests, LintModifiedExtensions from Tra…
Browse files Browse the repository at this point in the history
…vis to ADO (Azure#1174)
  • Loading branch information
Jianhui Harold authored Jan 8, 2020
1 parent a4837a9 commit 6a68da5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 42 deletions.
82 changes: 40 additions & 42 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,50 +66,48 @@ jobs:
python ./scripts/ci/test_index.py -v
displayName: "Verify Extensions Index"
# - job: TestsPython27
# displayName: "Tests Python 2.7"
# pool:
# vmImage: 'ubuntu-16.04'
# steps:
# - task: UsePythonVersion@0
# displayName: 'Use Python 2.7'
# inputs:
# versionSpec: 2.7
# - task: Bash@3
# displayName: "Tests Python 2.7"
# inputs:
# targetType: 'filePath'
# filePath: scripts/ci/test_source.sh
- job: SourceTests
displayName: "Integration Tests, Build Tests"
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install wheel==0.30.0
displayName: 'Install wheel==0.30.0'
- bash: ./scripts/ci/test_source.sh
displayName: 'Run integration test and build test'
env:
ADO_PULL_REQUEST_LATEST_COMMIT: $(System.PullRequest.SourceCommitId)
ADO_PULL_REQUEST_TARGET_BRANCH: $(System.PullRequest.TargetBranch)

- job: LintModifiedExtensions
displayName: "CLI Linter on Modified Extensions"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
versionSpec: 3.6
- bash: |
set -ev
# - job: TestsPython37
# displayName: "Tests Python 3.7"
# pool:
# vmImage: 'ubuntu-16.04'
# steps:
# - task: UsePythonVersion@0
# displayName: 'Use Python 3.7'
# inputs:
# versionSpec: 3.7
# - task: Bash@3
# displayName: "Tests Python 3.7"
# inputs:
# targetType: 'filePath'
# filePath: scripts/ci/test_source.sh
# prepare and activate virtualenv
pip install virtualenv
python -m virtualenv venv/
source ./venv/bin/activate
# - job: LintModifiedExtensions
# displayName: "CLI Linter on Modified Extensions"
# pool:
# vmImage: 'ubuntu-16.04'
# steps:
# - task: UsePythonVersion@0
# displayName: 'Use Python 3.7'
# inputs:
# versionSpec: 3.7
# - task: Bash@3
# displayName: "CLI Linter on Modified Extension"
# inputs:
# targetType: 'filePath'
# filePath: scripts/ci/verify_modified_index.sh
./scripts/ci/verify_modified_index.sh
displayName: "CLI Linter on Modified Extension"
- job: IndexRefDocVerify
displayName: "Verify Ref Docs"
Expand Down
10 changes: 10 additions & 0 deletions scripts/ci/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import tempfile
import unittest
import shutil
import shlex
from subprocess import check_output, check_call, CalledProcessError

import mock
Expand All @@ -34,6 +35,15 @@
if commit_range and not check_output(['git', '--no-pager', 'diff', '--name-only', commit_range, '--', src_d_full]):
continue

# Running in Azure DevOps
cmd_tpl = 'git --no-pager diff --name-only origin/{commit_start} {commit_end} {code_dir}'
ado_branch_last_commit = os.environ.get('ADO_PULL_REQUEST_LATEST_COMMIT')
ado_target_branch = os.environ.get('ADO_PULL_REQUEST_TARGET_BRANCH')
if ado_branch_last_commit and ado_target_branch:
cmd = cmd_tpl.format(commit_start=ado_target_branch, commit_end=ado_branch_last_commit, code_dir=src_d_full)
if not check_output(shlex.split(cmd)):
continue

# Find the package and check it has tests
if pkg_name and os.path.isdir(os.path.join(src_d_full, pkg_name, 'tests')):
ALL_TESTS.append((pkg_name, src_d_full))
Expand Down

0 comments on commit 6a68da5

Please sign in to comment.