mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 17:40:24 +08:00
- Created custom upload-artifacts and download-artifacts actions with platform-specific logic - Updated all existing workflows to use the new custom artifact actions - Added extraction steps for tar.gz archives in the test summary workflow
135 lines
4.8 KiB
YAML
135 lines
4.8 KiB
YAML
name: 'Test Summary'
|
|
description: 'Compare test results between current branch and master'
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Download vcpkg cache
|
|
uses: ./.github/actions/download-vcpkg-cache
|
|
with:
|
|
artifact-name: install-linux-clang-x64-cache
|
|
|
|
- name: Install dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y cmake clang g++ make libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev
|
|
shell: bash
|
|
|
|
- name: Setup Xvfb and Mesa
|
|
uses: ./.github/actions/setup-xvfb-mesa
|
|
|
|
- name: Set environment variables
|
|
run: |
|
|
echo "DISPLAY=:99" >> $GITHUB_ENV
|
|
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Download and extract install directory
|
|
uses: ./.github/actions/download-artifacts
|
|
with:
|
|
name: install-linux-clang-x64
|
|
path: install
|
|
|
|
- name: Set execute permissions on DRAWEXE
|
|
run: chmod +x install/bin/DRAWEXE
|
|
shell: bash
|
|
|
|
- name: Get latest workflow run ID from target branch
|
|
id: get_run_id
|
|
run: |
|
|
response=$(curl -s \
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=${{ github.event.pull_request.base.ref }}&status=success")
|
|
latest_run_id=$(echo "$response" | jq -r \
|
|
--arg repo "${{ github.repository }}" \
|
|
'.workflow_runs[] | select(.name=="Build and Test OCCT on Multiple Platforms" and .head_repository.full_name==$repo) | .id' | head -n 1)
|
|
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Download master branch test results
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
for platform in windows-x64 macos-x64 linux-clang-x64; do
|
|
echo "Downloading results for $platform"
|
|
gh run download ${{ env.latest_run_id }} -n "results-$platform" -D "install/bin/results/master/"
|
|
done
|
|
shell: bash
|
|
|
|
- name: Download current branch test results
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
for platform in windows-x64 macos-x64 linux-clang-x64; do
|
|
echo "Downloading results for $platform"
|
|
gh run download -n "results-$platform" -D "install/bin/results/current/"
|
|
done
|
|
shell: bash
|
|
|
|
- name: Compare test results
|
|
run: |
|
|
echo "Comparing test results..."
|
|
cd install/bin
|
|
source env.sh
|
|
for platform in windows-x64 macos-x64 linux-clang-x64; do
|
|
./DRAWEXE -v -c testdiff "results/current/$platform" "results/master/$platform" &
|
|
done
|
|
wait
|
|
shell: bash
|
|
|
|
- name: Install BeautifulSoup
|
|
run: pip install beautifulsoup4
|
|
shell: bash
|
|
|
|
- name: Clean unused test images
|
|
run: |
|
|
# copy to the install/bin/results directory
|
|
cp ${{ github.workspace }}/.github/actions/scripts/cleanup_test_images.py install/bin/results
|
|
cd install/bin/results
|
|
python cleanup_test_images.py
|
|
shell: bash
|
|
|
|
- name: Upload comparison results
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: test-compare-results
|
|
retention-days: 15
|
|
overwrite: true
|
|
path: |
|
|
install/bin/results/**/diff-*.html
|
|
install/bin/results/**/diff-*.log
|
|
install/bin/results/**/summary.html
|
|
install/bin/results/**/tests.log
|
|
install/bin/results/**/*.png
|
|
|
|
- name: Post performance summary to PR
|
|
if: github.repository == 'Open-Cascade-SAS/OCCT' && github.head_ref == 'IR' && github.base_ref == 'master'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
COMMENT_FILE=$(mktemp)
|
|
|
|
# Get commit ID and commit header
|
|
COMMIT_ID=$(git rev-parse HEAD)
|
|
COMMIT_HEADER=$(git log -1 --pretty=%s)
|
|
|
|
echo -e "**Performance Test Summary**\n" > "$COMMENT_FILE"
|
|
echo -e "**Commit**: \`${COMMIT_ID}\`\n" >> "$COMMENT_FILE"
|
|
echo -e "**Title**: ${COMMIT_HEADER}\n" >> "$COMMENT_FILE"
|
|
|
|
LOG_FILES=$(find install/bin/results/current -name "diff-*.log")
|
|
if [ -z "$LOG_FILES" ]; then
|
|
echo "No diff logs found." >> "$COMMENT_FILE"
|
|
else
|
|
for log_file in $LOG_FILES; do
|
|
PLATFORM=$(basename $(dirname "$log_file"))
|
|
echo "**Platform: ${PLATFORM}**" >> "$COMMENT_FILE"
|
|
echo '```' >> "$COMMENT_FILE"
|
|
grep -E "Total (MEMORY|CPU|IMAGE) difference:" "$log_file" >> "$COMMENT_FILE" || echo "No performance summary found." >> "$COMMENT_FILE"
|
|
echo '```' >> "$COMMENT_FILE"
|
|
echo "" >> "$COMMENT_FILE"
|
|
done
|
|
fi
|
|
gh pr comment ${PR_NUMBER} --body-file "$COMMENT_FILE"
|
|
rm "$COMMENT_FILE"
|
|
shell: bash
|