Skip to content

Commit

Permalink
#1: update azure pipeline syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Dec 19, 2024
1 parent 5210ce6 commit f1edf89
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions .azure/pipelines/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)"
Expand All @@ -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..."
Expand Down Expand Up @@ -106,58 +119,53 @@ jobs:
$(Agent.OS) | "$(cache_name)"
- bash: |
WORKSPACE=${{ github.workspace }}
if [[ "${{ matrix.runner.image }}" != "" ]]; then
WORKSPACE= $(Pipeline.Workspace)
if [[ "$(image)" != "" ]]; then
WORKSPACE=/workspace
fi
CMD='
cd '${WORKSPACE}'; \
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'

0 comments on commit f1edf89

Please sign in to comment.