Skip to content

Upd conda dependencies in Preset Containers 2024.2.0 #2195

Upd conda dependencies in Preset Containers 2024.2.0

Upd conda dependencies in Preset Containers 2024.2.0 #2195

# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Integration Tests
on:
pull_request: null
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
group-diff:
runs-on: ubuntu-latest
outputs:
groups: ${{ steps.group-list.outputs.FOLDERS }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: block
allowed-endpoints: >
github.com:443
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Output Modified Group Directories
id: group-list
run: |
# Get diff array filtered by specific filetypes
DIFF=$(git diff --diff-filter=d \
--name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} \
-- '*/*Dockerfile' '*.py' '*.yaml' '*.yml' '*.sh' '*/*requirements.txt' '*.json' | \
jq -R '.' | jq -sc '.' \
)
# Search for compose files in each file to determine the container groups
DOCKER_COMPOSE_PATHS=()
for path in $(echo $DIFF | jq -r '.[]'); do
while [[ "$path" != "." ]]; do
DIR_PATH=$(dirname "$path")
if [ -n "$(find "$DIR_PATH" -maxdepth 1 -name 'docker-compose.yaml' -print -quit)" ] && [ "$DIR_PATH" != "." ]; then
DOCKER_COMPOSE_PATHS+=("$DIR_PATH")
path="."
else
path="$DIR_PATH"
fi
done
done
# Convert the array to a JSON array
DOCKER_COMPOSE_PATHS_JSON=$(printf '%s\n' "${DOCKER_COMPOSE_PATHS[@]}" | jq -R '.' | jq -sc 'unique_by(.)')
echo "FOLDERS=$DOCKER_COMPOSE_PATHS_JSON" >> $GITHUB_OUTPUT
pipeline-ci:
needs: group-diff
if: needs.group-diff.outputs.groups != '[""]'
strategy:
matrix:
group: ${{ fromJson(needs.group-diff.outputs.groups) }}
experimental: [true]
fail-fast: false
uses: intel/ai-containers/.github/workflows/container-ci.yaml@main
with:
group_dir: ${{ matrix.group }}
secrets: inherit
merge-logs:
# download all artifacts across containers
needs: [pipeline-ci]
if: success() || failure()
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.0
id: download_artifact_outputs
with:
pattern: test-runner-summary*
merge-multiple: true
- name: Find Summary
id: summary
shell: bash
run: |
SUMMARY=$(find . -maxdepth 1 -name '*summary.json' -print)
if [[ -n "$SUMMARY" ]]; then
echo "summary=true" >> $GITHUB_OUTPUT
echo "Files matching the pattern ./*summary.json"
jq -s '[.[] | .[]]' ./*summary.json > combined.json
echo "Files found in the directory"
else
echo "summary=false" >> $GITHUB_OUTPUT
echo "No files matching the pattern ./*summary.json"
fi
- name: Generate TXT file
if: ${{ steps.summary.outputs.summary != 'false' }}
run: |
{
echo "### Integration Test Results"
echo "Groups Tested: $(jq -r 'map(.Group) | unique | join(", ")' combined.json)"
echo -e "\n<details>"
echo -e " <summary>Results</summary>\n"
echo " | Test-Group | Test | Status |"
echo " |:----:|:---:|:---:|"
jq -r '.[] | " | \(.Group) | \(.Test) | \(.Status) |"' combined.json
echo -e "\n</details>\n"
if jq -e 'all(.[]; .Status == "PASS")' combined.json > /dev/null; then
echo "#### Overall Result: PASS ✅"
else
echo "#### Overall Result: FAIL ❌"
fi
} >> output.txt
- name: PR-comment
if: ${{ steps.summary.outputs.summary != 'false' }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: test-runner combined summary
path: output.txt
recreate: true
status-check:
needs: [group-diff, pipeline-ci, merge-logs]
runs-on: ubuntu-latest
if: always()
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
&& needs.group-diff.outputs.groups != '[""]'
}}