|
4 | 4 | # https://aka.ms/yaml |
5 | 5 |
|
6 | 6 | trigger: |
7 | | -- master |
| 7 | + - develop |
| 8 | + - feature/azure_pipeline |
8 | 9 |
|
9 | 10 | pool: |
10 | | - vmImage: 'ubuntu-latest' |
| 11 | + vmImage: 'ubuntu-16.04' |
| 12 | + |
| 13 | +variables: |
| 14 | + DOCKHER_HUB_REPO: 'utplsqlv3/oracledb' |
| 15 | + # Timezone needed for working with Oracle DB |
| 16 | + TZ: UTC |
| 17 | + ORACLE_VERSION: '11g-r2-xe' |
| 18 | + CONNECTION_STR: '127.0.0.1:1521/XE' |
| 19 | + DOCKER_OPTIONS: '--shm-size=1g' |
| 20 | + DB_SYS_PASSWORD: oracle |
| 21 | + DB_USER: ut3_demo |
| 22 | + DB_PASS: ut3_demo |
| 23 | + SQLCL_DIR: $(Build.BinariesDirectory)/sqlcl |
| 24 | + UTPLSQL_DIR: $(Build.BinariesDirectory)/utPLSQL |
| 25 | + UTPLSQL_CLI_DIR: $(Build.BinariesDirectory)/utPLSQL-cli |
| 26 | + UTPLSQL_CLI_VERSION: 'v3.1.7' |
| 27 | + CACHE_DIR: $(Pipeline.Workspace)/.cache |
| 28 | + |
| 29 | +strategy: |
| 30 | + matrix: |
| 31 | + develop: |
| 32 | + UTPLSQL_VERSION: 'develop' |
| 33 | + v3.1.1: |
| 34 | + UTPLSQL_VERSION: 'v3.1.1' |
| 35 | + v3.1.2: |
| 36 | + UTPLSQL_VERSION: 'v3.1.2' |
| 37 | + v3.1.4: |
| 38 | + UTPLSQL_VERSION: 'v3.1.4' |
| 39 | + v3.1.7: |
| 40 | + UTPLSQL_VERSION: 'v3.1.7' |
11 | 41 |
|
12 | 42 | steps: |
13 | | -- script: echo Hello, world! |
14 | | - displayName: 'Run a one-line script' |
| 43 | +# Possible cache options: |
| 44 | +# https://marketplace.visualstudio.com/items?itemName=1ESLighthouseEng.PipelineArtifactCaching |
| 45 | +# https://github.com/Microsoft/azure-pipelines-yaml/pull/113 |
| 46 | + |
| 47 | + - task: CacheBeta@0 |
| 48 | + inputs: |
| 49 | + path: '$(CACHE_DIR)' |
| 50 | + key: './*' |
| 51 | + |
| 52 | +# - task: Cache@0 |
| 53 | +# inputs: |
| 54 | +# path: $(CACHE_DIR) |
| 55 | +# key: '*' |
| 56 | +# displayName: 'Restore cache' |
| 57 | + |
| 58 | + - bash: | |
| 59 | + echo "##vso[task.prependpath]$(UTPLSQL_CLI_DIR)/bin" |
| 60 | + echo "##vso[task.prependpath]$(SQLCL_DIR)/bin" |
| 61 | + displayName: 'Setup PATH variable' |
| 62 | +
|
| 63 | + - bash: | |
| 64 | + mkdir -p $(CACHE_DIR) |
| 65 | + .travis/install_sqlcl.sh -u $(ORACLE_OTN_USER) -p $(ORACLE_OTN_PASSWORD) -d $(CACHE_DIR) -o $(Build.BinariesDirectory) |
| 66 | + echo $PATH |
| 67 | + sql -v |
| 68 | + displayName: 'Install Oracle sqlcl' |
| 69 | +
|
| 70 | + - bash: | |
| 71 | + curl -Lk -o $(UTPLSQL_CLI_DIR).zip "https://github.com/utPLSQL/utPLSQL-cli/releases/download/$(UTPLSQL_CLI_VERSION)/utPLSQL-cli.zip" |
| 72 | + cd $(Build.BinariesDirectory) |
| 73 | + unzip $(UTPLSQL_CLI_DIR).zip && chmod -R u+x $(UTPLSQL_CLI_DIR) |
| 74 | + cp $(SQLCL_DIR)/lib/ojdbc8.jar $(UTPLSQL_CLI_DIR)/lib && cp $(SQLCL_DIR)/lib/orai18n.jar $(UTPLSQL_CLI_DIR)/lib |
| 75 | + displayName: 'Install utPLSQL-cli' |
| 76 | +
|
| 77 | + - bash: | |
| 78 | + git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR} |
| 79 | + # Needed for older versions of utPLSQL. |
| 80 | + displayName: 'Download utPLSQL' |
| 81 | +
|
| 82 | + - bash: | |
| 83 | + docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD) |
| 84 | + # download Oracle Database docker image from private repo and start the DB |
| 85 | + time docker pull ${DOCKHER_HUB_REPO}:${ORACLE_VERSION} |
| 86 | + # start the docker container (DB) |
| 87 | + time docker run -d --name ${ORACLE_VERSION} ${DOCKER_OPTIONS} -p 1521:1521 ${DOCKHER_HUB_REPO}:${ORACLE_VERSION} |
| 88 | + # Wait for DB startup |
| 89 | + time docker logs -f ${ORACLE_VERSION} | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered |
| 90 | + displayName: 'Start Oracle DB Docker container' |
| 91 | +
|
| 92 | + - bash: .travis/install_utplsql.sh |
| 93 | + displayName: 'Install utPLSQL' |
| 94 | + |
| 95 | + - bash: | |
| 96 | + source/setup_db_account.sh |
| 97 | + source/install.sh |
| 98 | + test/install.sh |
| 99 | + displayName: 'Deploy' |
| 100 | +
|
| 101 | + - bash: | |
| 102 | + $(UTPLSQL_CLI_DIR)/bin/utplsql run ${DB_USER}/${DB_PASS}@//${CONNECTION_STR} \ |
| 103 | + -source_path=source \ |
| 104 | + -test_path=test \ |
| 105 | + -f=ut_documentation_reporter -c \ |
| 106 | + -f=ut_coverage_sonar_reporter -o=coverage.xml \ |
| 107 | + -f=ut_sonar_test_reporter -o=test_results.xml \ |
| 108 | + -f=ut_coverage_cobertura_reporter -o=cobertura.xml \ |
| 109 | + -f=ut_junit_reporter -o=junit_test_results.xml \ |
| 110 | + --debug \ |
| 111 | + --failure-exit-code=0 |
| 112 | + cat test_results.xml |
| 113 | + cat coverage.xml |
| 114 | + displayName: 'Test' |
| 115 | +
|
| 116 | + - task: PublishTestResults@2 |
| 117 | + inputs: |
| 118 | + testResultsFormat: 'JUnit' |
| 119 | + testResultsFiles: '**/junit_test_results.xml' |
| 120 | + testRunTitle: 'Publish test results' |
| 121 | + displayName: 'Publish test results' |
15 | 122 |
|
16 | | -- script: | |
17 | | - echo Add other tasks to build, test, and deploy your project. |
18 | | - echo See https://aka.ms/yaml |
19 | | - displayName: 'Run a multi-line script' |
| 123 | + - task: PublishCodeCoverageResults@1 |
| 124 | + inputs: |
| 125 | + codeCoverageTool: 'Cobertura' |
| 126 | + summaryFileLocation: 'cobertura.xml' |
| 127 | + pathToSources: 'source' |
| 128 | + displayName: 'Publish coverage' |
0 commit comments