diff --git a/.azure/pipelines/build-and-test.yml b/.azure/pipelines/build-and-test.yml index 46bd592..6498549 100644 --- a/.azure/pipelines/build-and-test.yml +++ b/.azure/pipelines/build-and-test.yml @@ -23,10 +23,10 @@ jobs: steps: # Note: Filtering the test environments # A jq query can be used to filter the matrix of test environments - # - All (default): `matrix=$(cat github.json | jq '.matrix')` - # - CLang only: `matrix=$(cat github.json | jq '.matrix | map(select(.label | contains("clang")))')` - # - gcc>=11: `matrix=$(cat github.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+")))')` - # - gcc>=11|clang>=14 `matrix=$(cat github.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+-|clang-[1-9][2-9]+")))')` + # - All (default): `matrix=$(cat azure.json | jq '.matrix')` + # - CLang only: `matrix=$(cat azure.json | jq '.matrix | map(select(.label | contains("clang")))')` + # - gcc>=11: `matrix=$(cat azure.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+")))')` + # - gcc>=11|clang>=14 `matrix=$(cat azure.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+-|clang-[1-9][2-9]+")))')` - bash: | wget https://raw.githubusercontent.com/${{ variables.WF_REPO }}/refs/heads/${{ variables.WF_BRANCH }}/ci/shared/matrix/azure.json matrix=$(cat azure.json | jq -c '.matrix') @@ -42,10 +42,19 @@ jobs: pool: vmImage: $(vmImage) timeoutInMinutes: 180 + variables: + TS_YEAR: ~ + TS_MONTH: ~ + TS_DAY: ~ + TS: ~ + BUILD_DIR: /opt/foo/build + OUTPUT_DIR: /opt/foo/output + CACHE_DIR: /opt/foo/build/ccache + COVERAGE_ENABLED: 0 + JUNIT_REPORT_PATH: /opt/foo/output/junit.xml steps: - checkout: self fetchDepth: 0 - - bash: | echo "Environment=$(label)" echo "Runner=$(vmImage)" @@ -58,6 +67,10 @@ jobs: displayName: Display configuration - bash: | + if [ "$(name)" == "wf-amd64-ubuntu-22.04-gcc-12-cpp" ] + then + echo "##vso[task.setvariable variable=COVERAGE_ENABLED]1" + fi if [[ "$(image)" == "" ]]; then echo "::group::Setup in runner" echo "Set setup permissions..." @@ -106,8 +119,8 @@ jobs: $(Agent.OS) | "$(cache_name)" - bash: | - WORKSPACE=${{ github.workspace }} - if [[ "${{ matrix.runner.image }}" != "" ]]; then + WORKSPACE= $(Pipeline.Workspace) + if [[ "$(image)" != "" ]]; then WORKSPACE=/workspace fi CMD=' @@ -115,49 +128,44 @@ jobs: ls -l; \ chmod +x ./build.sh; \ \ - FOO_COVERAGE_ENABLED="${{ env.COVERAGE_ENABLED }}" \ - FOO_TEST_REPORT="${{ env.JUNIT_REPORT_PATH }}" \ + FOO_COVERAGE_ENABLED="$(COVERAGE_ENABLED)" \ + FOO_TEST_REPORT="$(JUNIT_REPORT_PATH)" \ ./build.sh' echo "Running ${CMD}" - if [[ "${{ matrix.runner.image }}" == "" ]]; then + if [[ "$(image)" == "" ]]; then bash -c "export $(cat .env | sed '/^[[:blank:]]*#/d;s/#.*//' | xargs) && $CMD"; else docker run \ --name test-container \ --env-file .env \ -w $WORKSPACE \ - -v ${{ github.workspace }}:/workspace \ - -v ${{ env.BUILD_DIR }}:/opt/foo/build \ - -v ${{ env.OUTPUT_DIR }}:/opt/foo/output \ + -v $(Build.SourcesDirectory)/$(Build.Repository.Name):/workspace \ + -v $(BUILD_DIR):/opt/foo/build \ + -v $(OUTPUT_DIR):/opt/foo/output \ -e CI="1" \ -e https_proxy="" \ -e http_proxy="" \ - ${{ matrix.runner.image }} \ + $(image) \ bash -c "$CMD" exit $(docker container inspect --format '{{.State.ExitCode}}' test-container) fi if [ -f" $FOO_TEST_REPORT" != "" ]; then - echo "JUNIT_REPORT_PATH=${FOO_TEST_REPORT}" >> "$GITHUB_OUTPUT" + echo "##vso[task.setvariable variable=JUNIT_REPORT_PATH]${FOO_TEST_REPORT}" fi - displayName: PR tests (vt) - condition: or( contains(variables['label'], 'mpich'), contains(variables['label'], 'openmpi') ) - - - bash: | - echo 'Unit tests reporting not implemented' - displayName: Report Unit tests + displayName: PR tests - task: PublishTestResults@2 inputs: testResultsFormat: 'JUnit' - testResultsFiles: '$(JUNIT_REPORT_PATH)' + testResultsFiles: $[variables.JUNIT_REPORT_PATH] - task: PublishPipelineArtifact@1 displayName: Upload artifacts continueOnError: true inputs: - targetPath: '$(env.OUTPUT_DIR)' - artifact: 'foo-output-$(name)' + targetPath: $[variables.OUTPUT_DIR] + artifact: 'foo-output-$(setup)' publishLocation: 'pipeline'